nextorm 1.0.1-alpha.141
dotnet add package nextorm --version 1.0.1-alpha.141
NuGet\Install-Package nextorm -Version 1.0.1-alpha.141
<PackageReference Include="nextorm" Version="1.0.1-alpha.141" />
paket add nextorm --version 1.0.1-alpha.141
#r "nuget: nextorm, 1.0.1-alpha.141"
// Install nextorm as a Cake Addin
#addin nuget:?package=nextorm&version=1.0.1-alpha.141&prerelease
// Install nextorm as a Cake Tool
#tool nuget:?package=nextorm&version=1.0.1-alpha.141&prerelease
Next ORM
The goal is to be as fast as Dapper but get rid of writing sql code manually.
All sql code and parameters should be generated automatically, with intellisense, type checking and other c# features.
NextORM is not really an ORM, because abbreviation "Object" can be removed. There is no change tracking (as ineffective), the entity class is not required. There are many ways to map data from database to objects: declarative (via attributes), fluent api, directly in query.
Features
- query compilation
- query parametrization
- ability to write queries without any entities and metadata at all
Examples
Select data via entity to map props and type to columns and table respectively
[SqlTable("simple_entity")]
public interface ISimpleEntity
{
[Key]
[Column("id")]
int Id {get;set;}
}
//...
// load data into anonymous object
foreach(var row in await dataContext.SimpleEntity.Select(entity => new { entity.Id }).ToListAsync())
{
_logger.LogInformation("Id = {id}", row.Id);
}
Select data without any entity, meta attributes, etc. Pure sql
foreach(var row in await dataContext.From("simple_entity").Select(tbl => new { Id = tbl.Int("id") }).ToListAsync())
{
_logger.LogInformation("Id = {id}", row.Id);
}
Subquery with strong typings
var innerQuery = dataContext.From("simple_entity").Select(tbl => new { Id = tbl.Int("id") });
await foreach(var row in dataContext.From(innerQuery).Select(subQuery=>new { subQuery.Id }))
{
_logger.LogInformation("Id = {id}", row.Id);
}
// generated code is
// select id from (select id from simple_entity)
Benchmarks
Benchmark is running under the following conditions:
- Nextorm is compiled buffered
- Dapper is buffered
- EF core is compiled buffered
- All queries is async
- Data provider is SQLite
- Computer configuration: Intel(R) Core(TM) i5-9600KF CPU @ 3.70GHz, RAM 16Gb
Method | Nextorm | Dapper | EF core | |
---|---|---|---|---|
Data fetch | 41.08 μs | 42.28 μs | 57.95 us | |
Wide data fetch | 10.060 ms | 13.789 ms | 12.858 ms | |
Where | 4.002 ms | 4.208 ms | 5.442 ms | |
Simulate work | 160.8 ms | 213.2 ms | 246.1 ms | |
Any | 31.74 us | 38.83 us | 54.16 us | |
FirstOrDefault | 337.4 us | 432.2 us | 586.9 us | |
SingleOrDefault | 36.65 us | 39.60 us | 51.99 us |
Summary
Place | Nextorm | Dapper | EF core |
---|---|---|---|
First | 7 | ||
Second | 6 | 1 | |
Third | 1 | 6 |
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net7.0 is compatible. 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. |
-
net7.0
- Microsoft.Extensions.DependencyInjection (>= 8.0.0)
- Microsoft.Extensions.Logging (>= 8.0.0)
- Microsoft.Extensions.ObjectPool (>= 8.0.0)
- OneOf (>= 3.0.263)
-
net8.0
- Microsoft.Extensions.DependencyInjection (>= 8.0.0)
- Microsoft.Extensions.Logging (>= 8.0.0)
- Microsoft.Extensions.ObjectPool (>= 8.0.0)
- OneOf (>= 3.0.263)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on nextorm:
Package | Downloads |
---|---|
nextorm.sqlserver
Microsoft SQL Server provider for Nextorm |
|
nextorm.sqlite
SQLite provider for Nextorm |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.0.1-alpha.141 | 113 | 1/9/2024 |
1.0.1-alpha | 74 | 1/5/2024 |