You hate verbatim SQL queries with zero type safety for your code but you love the speed? Dapper.FastCRUD is built around essential features of the C# 6 / VB 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. Visual Studio 2019 or later is recommended.
$ dotnet add package Dapper.FastCrudYou hate verbatim SQL queries with zero type safety for your code but you love the 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.
Type safety, clean code, less prone to errors, more peace of mind, while still being close to the metal. Here's a sample for 3.x:
var queryParams = new
{
FirstName = "John",
Street = "Creek Street"
};
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);
OrmConfiguration.ClearEntityRegistrations was not enough to clear the state between switching dialects via OrmConfiguration.DefaultDialect.DateOnly and TimeOnly data types, introduced in .NET6,
however provider support isn't all that great across database flavors.
Please check this discussion thread for more info.