FacilisDynamoDb 0.0.7
.NET 8.0
This package targets .NET 8.0. The package is compatible with this framework or higher.
.NET Standard 2.0
This package targets .NET Standard 2.0. The package is compatible with this framework or higher.
dotnet add package FacilisDynamoDb --version 0.0.7
NuGet\Install-Package FacilisDynamoDb -Version 0.0.7
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="FacilisDynamoDb" Version="0.0.7" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add FacilisDynamoDb --version 0.0.7
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: FacilisDynamoDb, 0.0.7"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install FacilisDynamoDb as a Cake Addin #addin nuget:?package=FacilisDynamoDb&version=0.0.7 // Install FacilisDynamoDb as a Cake Tool #tool nuget:?package=FacilisDynamoDb&version=0.0.7
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
FacilisDynamoDb
Overview
FacilisDynamoDb is a simple AWS DynamoDB client for .NET applications. It provides a straightforward way to interact with DynamoDB, including basic CRUD operations and table management.
Features
- Easy integration with AWS DynamoDB
- Basic CRUD operations
- Table management
- Supports .NET Standard 2.0
Usage
Configuration
- Add the necessary services to the
WebApplicationBuilder
in yourProgram.cs
:
using FacilisDynamoDb.Extensions.DependencyInjection.Extensions;
WebApplicationBuilder builder = WebApplication.CreateSlimBuilder(args);
builder.Services.AddFacilisDynamoDbClient<TodoEntity>(AppJsonSerializerContext.Default);
builder.Services.AddTableOptions(builder.Configuration);
builder.Services.AddLocalAmazonDynamoDbClient(builder.Configuration.GetValue<string>("AmazonDynamoDbServiceUrl")!);
builder.Services.AddScoped<TableGenerator>();
builder.Services.ConfigureHttpJsonOptions(options =>
{
options.SerializerOptions.TypeInfoResolverChain.Insert(0, AppJsonSerializerContext.Default);
});
WebApplication app = builder.Build();
- Define your DynamoDB entity:
public class TodoEntity : IIdentity
{
[JsonPropertyName(TableConstants.PrimaryKeyName)]
public string PrimaryKey { get; set; } = default!;
[JsonPropertyName(TableConstants.SortKeyName)]
public string SortKey { get; set; } = default!;
public int Id { get; set; }
public string? Title { get; set; }
public DateOnly? DueBy { get; set; }
public bool IsComplete { get; set; }
}
- Create and populate the DynamoDB table:
async Task CreateAmazonDynamoDbTableAsync(WebApplication app)
{
using IServiceScope scope = app.Services.CreateScope();
using TableGenerator tableGenerator = scope.ServiceProvider.GetRequiredService<TableGenerator>();
await tableGenerator.CreateTableAsync();
}
async Task PopulateDatabaseAsync(WebApplication app)
{
var sampleTodos = new TodoEntity[]
{
new() { Id = 1, PrimaryKey = "Note", SortKey = "1", Title = "Walk the dog", IsComplete = true },
new() { Id = 2, PrimaryKey = "Note", SortKey = "2", Title = "Do the dishes", DueBy = DateOnly.FromDateTime(DateTime.Now), IsComplete = true },
new() { Id = 3, PrimaryKey = "Note", SortKey = "3", Title = "Do the laundry", DueBy = DateOnly.FromDateTime(DateTime.Now.AddDays(1)), IsComplete = false }
};
using IServiceScope scope = app.Services.CreateScope();
using IFacilisDynamoDbClient<TodoEntity> client = scope.ServiceProvider.GetRequiredService<IFacilisDynamoDbClient<TodoEntity>>();
List<TodoEntity> notes = (await client.GetAllAsync("Note")).ToList();
if (notes.Count != 0) return;
foreach (TodoEntity sampleTodo in sampleTodos)
{
await client.CreateAsync(sampleTodo);
}
}
License
This project is licensed under the MIT License. See the LICENSE
file for more details.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.0
- AWSSDK.DynamoDBv2 (>= 3.7.404)
- Microsoft.Extensions.Logging.Abstractions (>= 8.0.1)
- Microsoft.Extensions.Options (>= 8.0.2)
- System.Text.Json (>= 8.0.5)
-
net8.0
- AWSSDK.DynamoDBv2 (>= 3.7.404)
- Microsoft.Extensions.Logging.Abstractions (>= 8.0.1)
- Microsoft.Extensions.Options (>= 8.0.2)
- System.Text.Json (>= 8.0.5)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on FacilisDynamoDb:
Package | Downloads |
---|---|
FacilisDynamoDb.Extensions.DependencyInjection
Simple AWS DynamoDb client |
GitHub repositories
This package is not used by any popular GitHub repositories.