Skip to content

Latest commit

 

History

History
40 lines (30 loc) · 1.9 KB

File metadata and controls

40 lines (30 loc) · 1.9 KB

Xfty.EntityFrameworkCore

NuGet

The real, database-backed IPersistenceGateway for Xfty - the piece that makes InsertMode.Now and .DepthBatched() actually persist, proven against a real Entity Framework Core DbContext (SQLite and a real Postgres container) rather than a mock.

dotnet add package Xfty.EntityFrameworkCore

Usage

using Net.NowhereAtAll.Xfty.EntityFrameworkCore;

Contact contact = (Contact)await new RecordProvider(typeof(Contact), lookup)
    .SetPersistenceGateway(new EfPersistenceGateway(dbContext))
    .SetInsertMode(InsertMode.Now)
    .Supply();

// contact is a real row, inserted through dbContext.SaveChangesAsync() -
// including its required Account, inserted first.

A string-typed Id left unset is filled with a fresh GUID before Add - the common shape for a string primary key, which EF Core has no built-in generator for (an integer identity column is left untouched; EF already populates that on its own after SaveChangesAsync()). One SaveChangesAsync() call per depth-batched layer when used with .DepthBatched().

Full documentation