SqlKata.EntityFrameworkCore 1.0.3

There is a newer version of this package available.
See the version list below for details.
dotnet add package SqlKata.EntityFrameworkCore --version 1.0.3                
NuGet\Install-Package SqlKata.EntityFrameworkCore -Version 1.0.3                
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.3" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add SqlKata.EntityFrameworkCore --version 1.0.3                
#r "nuget: SqlKata.EntityFrameworkCore, 1.0.3"                
#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.3

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

SqlKata.EntityFrameworkCore SqlKata.EntityFrameworkCore SqlKata.EntityFrameworkCore

.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 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. 
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,061 2/21/2023
1.0.3 1,020 9/18/2022
1.0.2 987 5/9/2022
1.0.1 891 5/9/2022
1.0.0 870 5/9/2022