SqlKata.QueryMan
1.0.0
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package SqlKata.QueryMan --version 1.0.0
NuGet\Install-Package SqlKata.QueryMan -Version 1.0.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="SqlKata.QueryMan" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add SqlKata.QueryMan --version 1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: SqlKata.QueryMan, 1.0.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install SqlKata.QueryMan as a Cake Addin #addin nuget:?package=SqlKata.QueryMan&version=1.0.0 // Install SqlKata.QueryMan as a Cake Tool #tool nuget:?package=SqlKata.QueryMan&version=1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
QueryMan
Fluent query manager based on SQLKata and Dapper.
How to use
Init QueryMan:
Db = new QueryRunner(
new SQLiteConnection(ConnectionString),
new SqliteCompiler()
);
Save to db:
var customer = new Customer("Customer 1");
Db.BeginTransaction();
await Db.SaveOrUpdateAsync(customer);
Db.Commit();
customer = await Db.GetAsync<Customer>(customer.Id);
Assert.Equal("Customer 1", customer.Name);
Get by Id:
var customer = await Db.GetAsync<Customer>(id);
Get from db:
Customer customer = null;
(string CustomerId, string CustomerName) queryResult = default;
var query = Db.Query<Customer>()
.Select(() => customer.Id, () => queryResult.CustomerId)
.Select(() => customer.Name, () => queryResult.CustomerName)
;
var result = await Db.ToListNoProxy<(string CustomerId, string CustomerName)>(query);
AssertHelper.CollectionContainsAll(result,
item => item.CustomerName == "Customer 1"
);
Get from db with GroupBy:
Contact contact = null;
Customer customer = null;
(string CustomerName, int ContactCount) queryResult = default;
var query = Db.Query(() => customer)
.LeftJoin(() => contact, () => contact.CustomerId, () => customer.Id)
.Select(() => customer.Name, () => queryResult.CustomerName)
.SelectCount(() => contact.Id, () => queryResult.ContactCount)
.GroupBy()
;
var result = await Db.ToListNoProxy<(string CustomerName, int ContactCount)>(query);
AssertHelper.CollectionContainsAll(result,
item => item.CustomerName == "Customer 1a" && item.ContactCount == 1,
item => item.CustomerName == "Customer 2" && item.ContactCount == 0
);
Batch Update:
Customer customer = null;
var query = Db.SelectAll(() => customer);
var result = await Db.ToList<Customer>(query);
foreach (var (c, i) in result.Select((c, i) => (c, i)))
{
c.SetName($"Customer No {i+1}");
}
Db.BeginTransaction();
await Db.SaveOrUpdateAsync(result);
Db.Commit();
Features
- Fluent queries
- Save/Update/Delete entities
- Transactions
- Pagination (not implemented)
Nuget
How to contribute
If you have any issues please provide us with Unit Test Example.
Please create an issue ticket to become a contributer.
Donations
Donate with nano.
Thank you!
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. 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 was computed. 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. |
.NET Core | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.1 is compatible. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.1
- CaseExtensions (>= 1.1.0)
- Castle.Core (>= 4.4.1)
- SqlKata (>= 2.3.7)
- SqlKata.Execution (>= 2.3.7)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on SqlKata.QueryMan:
Package | Downloads |
---|---|
SqlKata.QueryMan.AspNetCore
Fluent query manager based on SQLKata. Transaction Action Filter addon used in ASP.NET applications. |
|
SqlKata.QueryMan.AspNetCore.Identity
Fluent query manager based on SQLKata. ASP.NET Identity Stores implementation. |
GitHub repositories
This package is not used by any popular GitHub repositories.