SQLKata.EntityKata 1.0.3-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.3-alpha
                    
NuGet\Install-Package SQLKata.EntityKata -Version 1.0.3-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.3-alpha" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SQLKata.EntityKata" Version="1.0.3-alpha" />
                    
Directory.Packages.props
<PackageReference Include="SQLKata.EntityKata" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add SQLKata.EntityKata --version 1.0.3-alpha
                    
#r "nuget: SQLKata.EntityKata, 1.0.3-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.
#:package SQLKata.EntityKata@1.0.3-alpha
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=SQLKata.EntityKata&version=1.0.3-alpha&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=SQLKata.EntityKata&version=1.0.3-alpha&prerelease
                    
Install as a Cake Tool

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


// identity class is seperated for convenience
[Table("People")]
public class PersonIdentity
{
    [Identity]
    [Field("PersonId")]
    public int Id { get; set; }
}

[Table("People")]
public class Person : PersonIdentity 
{

    [Field("PersonName")]
    public string FirstName { get; set; }
    [Field("PersonLastName")]
    public string LastName { get; set; }
    [Field("PersonAge")]
    public int Age { get; set; }
    [Field("PersonPhone")]
    public string Phone { get; set; }
    [Field("PersonEmail")]
    public string Email { get; set; }
}

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

var peopleManager = env.Query<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.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.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 198 7/24/2022
1.1.0-alpha 170 7/23/2022
1.0.7-alpha 164 7/23/2022
1.0.6-alpha 163 7/23/2022
1.0.5-alpha 162 7/19/2022
1.0.4-alpha 160 7/19/2022
1.0.3-alpha 163 7/19/2022
1.0.2-alpha 148 7/19/2022
1.0.1-alpha 145 7/19/2022
1.0.0-alpha 156 7/18/2022