FacilisDynamoDb 0.0.7

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                
#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                

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

  1. Add the necessary services to the WebApplicationBuilder in your Program.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();
  1. 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; }
}
  1. 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 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.

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.

Version Downloads Last updated
0.0.7 144 1/6/2025
0.0.6 151 1/6/2025
0.0.5 211 12/28/2024
0.0.4 172 12/26/2024
0.0.3 146 12/26/2024
0.0.2 158 12/26/2024
0.0.1 147 12/26/2024