Entity Framework Core provider for YDB — a distributed SQL database by Yandex.
Built on top of the Ydb.Sdk ADO.NET provider.
dotnet add package EntityFrameworkCore.Ydb| Package | Supported EF Core version | Target framework |
|---|---|---|
EntityFrameworkCore.Ydb |
9.x | net8.0 |
EntityFrameworkCore.Ydb |
10.x | net10.0 |
public class AppDbContext : DbContext
{
public DbSet<Series> Series { get; set; }
protected override void OnConfiguring(DbContextOptionsBuilder options)
=> options.UseYdb("Host=localhost;Port=2136;Database=/local");
}
public class Series
{
public ulong SeriesId { get; set; }
public string Title { get; set; } = "";
public DateTime ReleaseDate { get; set; }
}dotnet tool install --global dotnet-ef
dotnet ef migrations add InitialCreate
dotnet ef database updateawait using var db = new AppDbContext();
var recent = await db.Series
.Where(s => s.ReleaseDate.Year >= 2020)
.OrderBy(s => s.Title)
.ToListAsync();- Full EF Core migration support (create / alter / drop tables)
- LINQ query translation to YQL
- Transactions (serializable and snapshot read-only)
- Retry policy integration via
UseYdb(..., options => options.UseRetryPolicy(...)) - Data types:
string,bool, integers,float/double,DateTime,DateOnly,TimeSpan,Guid,Json - Extended YDB types:
Date32,Datetime64,Timestamp64,Interval64 - Serial columns (auto-increment via
SERIAL) INSERT/UPDATE/DELETEbatching- One-to-one, one-to-many, many-to-many relationships
- Yandex Cloud authentication (service account key, metadata service)
options.UseYdb(
"Host=<endpoint>;Port=2135;Database=<db>;UseTls=true;ServiceAccountKeyFilePath=/path/to/key.json"
);