Goa.Clients.Dynamo.Analyzers
0.9.0-preview
dotnet add package Goa.Clients.Dynamo.Analyzers --version 0.9.0-preview
NuGet\Install-Package Goa.Clients.Dynamo.Analyzers -Version 0.9.0-preview
<PackageReference Include="Goa.Clients.Dynamo.Analyzers" Version="0.9.0-preview"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> </PackageReference>
<PackageVersion Include="Goa.Clients.Dynamo.Analyzers" Version="0.9.0-preview" />
<PackageReference Include="Goa.Clients.Dynamo.Analyzers"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> </PackageReference>
paket add Goa.Clients.Dynamo.Analyzers --version 0.9.0-preview
#r "nuget: Goa.Clients.Dynamo.Analyzers, 0.9.0-preview"
#:package Goa.Clients.Dynamo.Analyzers@0.9.0-preview
#addin nuget:?package=Goa.Clients.Dynamo.Analyzers&version=0.9.0-preview&prerelease
#tool nuget:?package=Goa.Clients.Dynamo.Analyzers&version=0.9.0-preview&prerelease
Goa.Clients.Dynamo.Analyzers
Roslyn analyzers and code fixes for the Goa DynamoDB client. These analyzers help enforce best practices and cleaner code patterns when working with DynamoDB models.
Features
- Detects opportunities to use extension methods instead of static mapper calls
- Automatic code fixes for one-click refactoring
- Supports batch fixing across entire solutions
- Configurable behavior via MSBuild properties
Quick Start
This package is automatically included when you install Goa.Clients.Dynamo. No additional setup is required.
If you need to install it separately:
dotnet add package Goa.Clients.Dynamo.Analyzers
Diagnostics
GOA001: Use extension method instead of DynamoMapper
| Property | Value |
|---|---|
| ID | GOA001 |
| Category | Usage |
| Severity | Info |
| Enabled | Yes (default) |
Description
When the ToDynamoRecord() extension method is available, prefer using it over the static DynamoMapper method for cleaner code.
Before
var record = DynamoMapper.User.ToDynamoRecord(user);
After
var record = user.ToDynamoRecord();
Trigger Conditions
This diagnostic is reported when all of the following conditions are met:
- Code calls
DynamoMapper.X.ToDynamoRecord(model)with exactly one argument - The model type has an available extension method, determined by either:
- The type has the
[Extension]attribute applied directly - The
GoaAutoGenerateExtensionsproperty is enabled AND the type (or a base type) has the[DynamoModel]attribute
- The type has the
Configuring Extension Generation
Control whether extensions are automatically generated for all [DynamoModel] types using the GoaAutoGenerateExtensions MSBuild property.
In your .csproj file:
<PropertyGroup>
<GoaAutoGenerateExtensions>true</GoaAutoGenerateExtensions>
</PropertyGroup>
When enabled:
- The analyzer will suggest using extension methods for any type with
[DynamoModel](including inherited) - No explicit
[Extension]attribute is required on individual types
When disabled (default):
- The analyzer only suggests extensions for types with the explicit
[Extension]attribute
Code Fix Capabilities
The included code fix provider offers:
- Single fix: Apply the fix to an individual diagnostic
- Fix all in document: Apply to all occurrences in the current file
- Fix all in project: Apply to all occurrences in the current project
- Fix all in solution: Apply to all occurrences across the entire solution
The code fix transforms DynamoMapper.X.ToDynamoRecord(model) into model.ToDynamoRecord(), preserving any leading and trailing trivia (whitespace, comments).
Examples
Basic Usage
[DynamoModel(PK = "USER#<Id>", SK = "PROFILE")]
[Extension]
public class User
{
public string Id { get; set; }
public string Name { get; set; }
}
// Before (triggers GOA001)
var record = DynamoMapper.User.ToDynamoRecord(user);
// After (preferred)
var record = user.ToDynamoRecord();
Inheritance Scenarios
When GoaAutoGenerateExtensions is enabled, the analyzer recognizes inherited [DynamoModel] attributes:
[DynamoModel(PK = "ENTITY#<Id>", SK = "BASE")]
public abstract class BaseEntity
{
public string Id { get; set; }
}
// No [DynamoModel] attribute needed - inherits from BaseEntity
public class Customer : BaseEntity
{
public string Email { get; set; }
}
// With GoaAutoGenerateExtensions=true, this triggers GOA001
var record = DynamoMapper.Customer.ToDynamoRecord(customer);
// Preferred
var record = customer.ToDynamoRecord();
Explicit Extension Attribute Usage
Use the [Extension] attribute when you want to enable the extension method without GoaAutoGenerateExtensions:
[DynamoModel(PK = "ORDER#<Id>", SK = "DETAILS")]
[Extension] // Explicitly enables extension method
public class Order
{
public string Id { get; set; }
public decimal Total { get; set; }
}
// Triggers GOA001 regardless of GoaAutoGenerateExtensions setting
var record = DynamoMapper.Order.ToDynamoRecord(order);
Suppressing Diagnostics
Inline Suppression
#pragma warning disable GOA001
var record = DynamoMapper.User.ToDynamoRecord(user);
#pragma warning restore GOA001
Attribute-Based Suppression
[System.Diagnostics.CodeAnalysis.SuppressMessage("Usage", "GOA001")]
public void ProcessUser(User user)
{
var record = DynamoMapper.User.ToDynamoRecord(user);
}
Project-Wide Suppression
In your .editorconfig:
[*.cs]
dotnet_diagnostic.GOA001.severity = none
Or in your .csproj:
<PropertyGroup>
<NoWarn>$(NoWarn);GOA001</NoWarn>
</PropertyGroup>
Documentation
For more information about the DynamoDB client, see the Goa.Clients.Dynamo README.
For the full Goa documentation, visit the main repository.
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.0
- No dependencies.
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Goa.Clients.Dynamo.Analyzers:
| Package | Downloads |
|---|---|
|
Goa.Clients.Dynamo
DynamoDB client with source generator support for high-performance AWS Lambda functions |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.9.0-preview | 46 | 6/18/2026 |
| 0.8.0-preview | 479 | 3/17/2026 |
| 0.7.8-preview | 109 | 3/3/2026 |
| 0.7.7-preview | 70 | 3/3/2026 |
| 0.7.6-preview | 74 | 3/3/2026 |
| 0.7.5-preview | 88 | 3/2/2026 |
| 0.7.4-preview | 80 | 3/1/2026 |
| 0.7.3-preview | 78 | 2/28/2026 |
| 0.7.2-preview | 101 | 2/23/2026 |
| 0.7.1-preview | 206 | 1/26/2026 |
| 0.7.0-preview | 76 | 1/26/2026 |
| 0.2.1-preview | 133 | 1/20/2026 |
| 0.2.0-preview | 157 | 1/14/2026 |
| 0.1.9-preview | 162 | 1/1/2026 |
| 0.1.8-preview | 325 | 12/15/2025 |
| 0.1.7-preview | 230 | 12/15/2025 |
| 0.1.6-preview | 226 | 12/15/2025 |
| 0.1.5-preview | 231 | 12/15/2025 |
| 0.1.4-preview | 222 | 12/15/2025 |