Installation
Add the
nextormcore package plus one database-provider package to anet10.0ornet11.0project, then use theNextORM.Coretypes from code.
Prerequisites: A project targeting net10.0 or net11.0.
Overview
NextORM is split into a small, driver-free core package and one package per relational provider:
nextorm(assemblynextorm.core) contains the query builder and compiler, entity metadata, the dependency-injection helpers, the plan cache and the in-memory provider (InMemoryDataContext). It referencesMicrosoft.Extensions.DependencyInjection,Microsoft.Extensions.LoggingandMicrosoft.Extensions.ObjectPool, but no database driver.nextorm.sqlite,nextorm.sqlserver,nextorm.postgres,nextorm.mysql,nextorm.mariadbandnextorm.clickhouseeach add one concrete context (SqliteDataContext,SqlServerDataContext,PostgresDataContext,MySqlDataContext,MariaDbDataContext,ClickHouseDataContext) and aUse…registration extension. The provider packages depend onnextormtransitively.nextorm.extensionsis an optional product package that adds the query-component operatorsSelectWhereMin/SelectWhereMaxandSelectGroup/SelectGroupHavingon top of the public query-component layer. It referencesnextorm.coreonly, needs no provider package of its own and works with every provider; see Extensions package.nextorm.entityframeworkcoreis an optional bridge package that runs nextorm queries and commands over an existing EF CoreDbContextconnection and transaction, reusing the EF model mapping (db.CreateNextOrmContext()); see EF Core integration.
1.0.9 is the first stable release, so the install commands below no longer need --prerelease.
Preview builds (1.0.10-a.x and later) still do.
Install the core package
dotnet add package nextorm
Then add exactly one provider package for the database you target:
dotnet add package nextorm.sqlite
dotnet add package nextorm.sqlserver
dotnet add package nextorm.postgres
dotnet add package nextorm.mysql
dotnet add package nextorm.mariadb
dotnet add package nextorm.clickhouse
The nextorm.extensions package is optional. Add it when you need the component-based
SelectWhereMin / SelectWhereMax or the inferred-grouping SelectGroup / SelectGroupHaving; it
works with any provider:
dotnet add package nextorm.extensions
The nextorm.entityframeworkcore package is optional as well — add it when an application already has
an EF Core DbContext and you want nextorm queries over the same connection:
dotnet add package nextorm.entityframeworkcore
The Package Manager Console equivalent:
Install-Package nextorm
Install-Package nextorm.sqlite
Package reference
| Package | Package ID | Adds | Driver |
|---|---|---|---|
| Core | nextorm |
Query engine, metadata, DI, in-memory provider | — |
| SQLite | nextorm.sqlite |
SqliteDataContext, UseSqlite |
Microsoft.Data.Sqlite |
| SQL Server | nextorm.sqlserver |
SqlServerDataContext, UseSqlServer |
Microsoft.Data.SqlClient |
| PostgreSQL | nextorm.postgres |
PostgresDataContext, UsePostgres |
Npgsql |
| MySQL | nextorm.mysql |
MySqlDataContext, UseMySql |
MySqlConnector |
| MariaDB | nextorm.mariadb |
MariaDbDataContext, UseMariaDb |
MySqlConnector |
| ClickHouse | nextorm.clickhouse |
ClickHouseDataContext, UseClickHouse |
ClickHouse.Driver |
| Extensions (optional) | nextorm.extensions |
SelectWhereMin / SelectWhereMax and SelectGroup / SelectGroupHaving, on top of nextorm.core |
— |
| EF Core (optional) | nextorm.entityframeworkcore |
CreateNextOrmContext — nextorm queries over an existing DbContext connection and transaction |
Microsoft.EntityFrameworkCore.Relational |
The in-memory provider lives in the core package, so it is available without installing a provider.
Target framework
The packages multi-target net10.0 and net11.0, so NuGet resolves the asset that matches the
consuming project, and enable implicit usings and nullable reference types. A
PackageReference looks like this:
<ItemGroup>
<PackageReference Include="nextorm" Version="1.0.9" />
<PackageReference Include="nextorm.sqlite" Version="1.0.9" />
</ItemGroup>
For a preview build, float to the newest prerelease with Version="*-*".
What to read next
- Quickstart - a complete minimal program.
- Entities and metadata - attributes, interface/class mapping and the
entity-free
TableAliasmode. - Dependency injection - registering a context with
AddNextOrmContextand the providerUse…methods. - Extensions package - the optional
nextorm.extensionsoperators and when to use them instead of the built-in ones.
Source: docs/index.md:91; src/nextorm.core/nextorm.core.csproj:4;
src/nextorm.sqlite/nextorm.sqlite.csproj:7; src/nextorm.sqlserver/nextorm.sqlserver.csproj:16;
src/nextorm.postgres/nextorm.postgres.csproj:8;
in-memory availability: tests/nextorm.core.tests/DependencyInjection/DependencyInjectionTests.cs:16.