Home

Awesome

You hate verbatim SQL queries with zero type safety for your code but you love their speed? Dapper.FastCrud is a fast orm built around essential features of the C# 6 / VB 14 that have finally raised the simplicity of raw SQL constructs to acceptable maintenance levels. These features leave no chance to mistypings or problems arising from db entity refactorings.

What to expect when working with Dapper.FastCrud in the DAL?

Type safety, clean code, less prone to errors, more peace of mind, while still being close to the metal. Here's a sample:

// Create paramters for the query
var queryParams = new 
{
    FirstName = "John",
    Street = "Creek Street"
};

// Get persons using the above created query parameters
var persons = dbConnection.Find<Person>(statement => statement
   .WithAlias("person")
   .Include<Address>(join =>
        join.InnerJoin()
            .WithAlias("address"))
   .Where($@"
        {nameof(Person.FirstName):of person} = {nameof(queryParams.FirstName):P} 
        AND {nameof(Address.Street):of address} = {nameof(queryParams.Street):P}")
   .OrderBy($"{nameof(Person.LastName):of person} DESC")  
   .Skip(10)
   .Top(20)
   .WithParameters(queryParams);

Features:

Active Versions

Check the release notes for the main library as well as the model generator for information about the recent changes.

WIKI

The wiki is a great place for learning more about this library.

Speed

Let's have a look at some popular ORMs out there and benchmark their speed:

Automatic Benchmark Report (Last Run: Friday, May 31, 2024)
LibraryOperationOp CountTime (ms)Time/op (μs)
<a name="new_entry_marker"/>
Dapperinsert100001,333.28133.33
Fast Crudinsert100001,396.15139.62
Dapper Extensionsinsert100001,513.42151.34
Simple Crudinsert100001,490.36149.04
Entity Framework - single op/callinsert1000015,056.931,505.69
Dapperupdate100001,290.22129.02
Fast Crudupdate100001,314.45131.45
Dapper Extensionsupdate100001,541.99154.20
Simple Crudupdate100001,381.38138.14
Entity Framework - single op/callupdate1000027,445.402,744.54
Dapperdelete100001,209.75120.98
Fast Cruddelete100001,234.92123.49
Dapper Extensionsdelete100001,327.86132.79
Simple Cruddelete100001,306.30130.63
Entity Framework - single op/calldelete100002,097.67209.77
Dapperselect by id10000569.2956.93
Fast Crudselect by id10000570.5456.35
Dapper Extensionsselect by id100001,941.33194.13
Simple Crudselect by id10000600.4560.04
Entity Frameworkselect by id10000902.9590.30
Dapperselect all10000532.2253.22
Fast Crudselect all10000574.9957.50
Dapper Extensionsselect all100003,012.01301.20
Simple Crudselect all10000611.3461.13
Entity Frameworkselect all100001,465.61146.56

Dapper is included for reference. All the libs involved get their own internal cache cleared before each run, the benchmark database is re-created, data file gets pre-allocated, and the statistics are turned off. The tests are following the same steps and are running in the same environment on the same number and size of records.

You can find more details about how to run the benchmarks yourself in the wiki.

Install the main library and the model generator via NuGet and enjoy!