Skip to content

EntityFrameworkCore.DynamoDb

Use EF Core's familiar LINQ API against Amazon DynamoDB. Queries are translated to PartiQL and executed via the AWS SDK — no manual AttributeValue wrangling required.

NuGet

Community project

This is an independent, community-maintained library. It is not affiliated with, endorsed by, or supported by Amazon Web Services or Microsoft.

Preview release

This library is in preview. Review [known limitations](limitations.md) before adopting it.

Requirements

Dependency Version
.NET 10.0+
EF Core 10.0+
AWSSDK.DynamoDBv2 (transitive)

Install

dotnet add package EntityFrameworkCore.DynamoDb

See Getting Started for full setup instructions.

Quick Example

// Define your entity
public class Order
{
    public string Pk { get; set; } = null!;   // e.g. "CUSTOMER#cust-42"
    public string Sk { get; set; } = null!;   // e.g. "ORDER#ord-99"
    public decimal Total { get; set; }
}

// Configure your DbContext
public class ShopContext(DbContextOptions<ShopContext> options) : DbContext(options)
{
    public DbSet<Order> Orders => Set<Order>();

    protected override void OnModelCreating(ModelBuilder modelBuilder)
    {
        modelBuilder.Entity<Order>(b =>
        {
            b.HasPartitionKey(o => o.Pk);
            b.HasSortKey(o => o.Sk);
        });
    }
}

// Create a DbContext
var options = new DbContextOptionsBuilder<ShopContext>()
    .UseDynamo()
    .Options;

await using var context = new ShopContext(options);

// Query
var orders = await context.Orders
    .Where(o => o.Pk == "CUSTOMER#cust-42" && o.Sk.StartsWith("ORDER#") && o.Total > 100m)
    .OrderBy(o => o.Sk)
    .ToListAsync();

Key Features

  • LINQ to PartiQLWhere, Select, OrderBy, Limit(n), and more translated server-side
  • Complex properties and collections — map nested documents as complex types and complex collections
  • Secondary indexes — query GSIs and LSIs with index hints
  • Optimistic concurrency — version tokens via EF Core's IsConcurrencyToken
  • Pagination — cursor-based pagination using DynamoDB's NextToken
  • Type mappingsGuid, DateTime, DateOnly, TimeOnly, enum, byte[], and more

Explore the Docs

  • Getting Started

    Install the package, configure your DbContext, and run your first query.

  • DynamoDB Concepts for EF Developers

    Understand how DynamoDB's partition model maps to EF Core concepts.

  • Configuration

    Client setup, table and key mapping, attribute naming, and DbContext options.

  • Data Modeling

    Entities, keys, complex properties, secondary indexes, and inheritance.

  • Querying

    Supported LINQ operators, filtering, projection, ordering, and pagination.

  • Saving Data

    Add, update, delete, transactions, and optimistic concurrency.

Limitations

This provider does not support all EF Core features. DynamoDB's access-pattern model means some LINQ shapes cannot be translated. See Limitations for the authoritative list of what is not supported and why.

License

MIT. See LICENSE on GitHub.