SqlKata.EntityFrameworkCore 1.0.5

dotnet add package SqlKata.EntityFrameworkCore --version 1.0.5                
NuGet\Install-Package SqlKata.EntityFrameworkCore -Version 1.0.5                
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.EntityFrameworkCore" Version="1.0.5" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add SqlKata.EntityFrameworkCore --version 1.0.5                
#r "nuget: SqlKata.EntityFrameworkCore, 1.0.5"                
#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.EntityFrameworkCore as a Cake Addin
#addin nuget:?package=SqlKata.EntityFrameworkCore&version=1.0.5

// Install SqlKata.EntityFrameworkCore as a Cake Tool
#tool nuget:?package=SqlKata.EntityFrameworkCore&version=1.0.5                

SqlKata.EntityFrameworkCore SqlKata.EntityFrameworkCore SqlKata.EntityFrameworkCore build

.NET library that aims to facilitate the combination of DbContexts (EntityFrameworkCore) and SqlKata queries.

Installation

PM> Install-Package SqlKata.EntityFrameworkCore

Example

using SqlKata;
using SqlKata.Compilers;
using SqlKata.EntityFrameworkCore;


using var Db = new MyDbContext();

// Set the compiler.
SqlKataEntityFramework.SetDefaultCompiler(new MySqlCompiler());

// Example 1
var BerkanLogins = Db.UsersLogins.FromSqlKata(
	Query => Query.From("users_logins").Where("user_id", 1).Limit(0).OrderByDesc("id")).ToList();
Console.WriteLine($"BerkanLogins: Admin logged in {BerkanLogins.Count} times, last login from {BerkanLogins.FirstOrDefault()?.IpAddress}");

// Example 2
var UserLogin2 = Db.UsersLogins.FromSqlKata(new Query("users_logins")
	.Where("user_id", "6")
	.Limit(1))
	.FirstOrDefault();
Console.WriteLine($"UserLogin2: {UserLogin2?.IpAddress}");

// Example 3 - Executing commands
var LoginsDeleted = Db.Database.ExecuteSqlKata(new Query("users_logins")
	.Where("ip_address", "LIKE", "127.0.0.1")
	.OrderBy("id")
	.AsDelete());
Console.WriteLine($"{LoginsDeleted} logins were deleted!");

// Example 4 - Executing commands
var RowsUpdated = Db.Database.ExecuteSqlKata(new Query("users_groups_links")
	.AsUpdate(new { user_group_id = 7 })
	.Where("user_id", 1)
	.Where("user_group_id", 6));
Console.WriteLine($"{RowsUpdated} rows were affected!");

License

You are free to use this library however you or your company wants to.

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  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 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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.5 5,404 2/21/2023
1.0.3 1,029 9/18/2022
1.0.2 994 5/9/2022
1.0.1 898 5/9/2022
1.0.0 876 5/9/2022