SQLKata.EntityKata 1.0.5-alpha

This is a prerelease version of SQLKata.EntityKata.
There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package SQLKata.EntityKata --version 1.0.5-alpha
NuGet\Install-Package SQLKata.EntityKata -Version 1.0.5-alpha
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.EntityKata" Version="1.0.5-alpha" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add SQLKata.EntityKata --version 1.0.5-alpha
#r "nuget: SQLKata.EntityKata, 1.0.5-alpha"
#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.EntityKata as a Cake Addin
#addin nuget:?package=SQLKata.EntityKata&version=1.0.5-alpha&prerelease

// Install SQLKata.EntityKata as a Cake Tool
#tool nuget:?package=SQLKata.EntityKata&version=1.0.5-alpha&prerelease

SQLKata.EntityKata

Entity Modeler using SQLKata

The idea is to focus the code using only entities names instead of SQL queries to model the data, to reduce errors abstract the logic. The library is based on SQLKata and does all the translations under the hood.

Especially useful when entities and database columns have different names. If a property doesn't have the field attribute it will be skipped.

This is the first release for optimization and testing.

More methods (and examples) will be added in the future.

Using entity Person that represents a record in table People

var env = new EntityKataService(new MySqlConnection("Server=localhost;Database=entitkatatest;Uid=root;Pwd=;")
    , new MySqlCompiler());

var peopleManager = env.Create<Person>();

var people = peopleManager.Get();

foreach(var person in people) {
    Console.WriteLine("{0} {1}", person.FirstName, person.LastName);
}

// if you have a separated Id class you can use it, otherwise 
// you can use an anonymous class
// Both of the following are valid    
people = peopleManager.Where(new Person {Id = 2}).Get();
people = peopleManager.Where(new {Id = 2}).Get();

var insertedRows = peopleManager.Insert(new Person
{
    Age = 33,
    Email = "onon@test.com",
    FirstName = "Marlon",
    LastName = "Bereny",
    Phone = "374873434"
});

Console.WriteLine("Inserted rows: " + insertedRows);

var deletedRows = peopleManager.Where(new {FirstName = "Marlon"}).Delete();

Console.WriteLine("Deleted rows: " + deletedRows);

people = peopleManager
    .OrderByDesc(nameof(Person.LastName))
    .Get();

foreach(var person in people) {
    Console.WriteLine("{0} {1}", person.FirstName, person.LastName);
}
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.1.1-alpha 134 7/24/2022
1.1.0-alpha 108 7/23/2022
1.0.7-alpha 105 7/23/2022
1.0.6-alpha 103 7/23/2022
1.0.5-alpha 104 7/19/2022
1.0.4-alpha 102 7/19/2022
1.0.3-alpha 105 7/19/2022
1.0.2-alpha 96 7/19/2022
1.0.1-alpha 90 7/19/2022
1.0.0-alpha 105 7/18/2022