ionix.Data.SQLite 2.0.7

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

// Install ionix.Data.SQLite as a Cake Tool
#tool nuget:?package=ionix.Data.SQLite&version=2.0.7                

ionix is a micro-orm library that based on .net standart 2.0 (which supports Linux, Windows and macOS).

From NuGet

Install-Package ionix.Data

It' s very easy to use, here is some Northwind database examples:

Select Operations

using (var db = ionixFactory.CreateDbClient())
{
    var employee = db.Cmd.SelectById<Employees>(1);
    employee = await db.Cmd.SelectByIdAsync<Employees>(1);	
	
    var employee = dbCmd.QuerySingle<Employees>("select * from Employees where EmployeeID=@0".ToQuery(1)); 
    employee = await dbCmd.QuerySingleAsync<Employee>("select * from Employees where EmployeeID=@0".ToQuery(1));
	
    IList<Employees> employeeList = dbCmd.Query<Employees>("select * from Employees".ToQuery());
    employeeList = await dbCmd.QueryAsync<Employees>("select * from Employees".ToQuery());

    var q = @"select o.*, c.*, e.* from Orders o
              inner join Customers c on o.CustomerID = c.CustomerID
              inner join Employees e on o.EmployeeID = e.EmployeeID".ToQuery();
    var models = db.Cmd.Query<Orders, Customers, Employees>(q);
    models = await db.Cmd.QueryAsync<Orders, Customers, Employees>(q); 	
}

Select Operations #2

using (var db = ionixFactory.CreateDbClient())
{
    int regionId = db.Cmd.QuerySingle<int>("select top 1 RegionID from Region".ToQuery());
    
    IList<int> regionIds = db.Cmd.Query<int>("select RegionID from Region".ToQuery());

    dynamic customers = db.Cmd.QuerySingle<dynamic>("select top 1 * from Customers t".ToQuery());
    IList<dynamic> customers = db.Cmd.Query<dynamic>("select * from Customers t".ToQuery());

    IList<Categories> categories = (IList<Categories>)client.Cmd.QueryNonGeneric(typeof(Categories), "select top 3 * from Categories".ToQuery());
}

Update Operations

using (var db = ionixFactory.CreateTransactionalDbClient())
{
    Categories c = new Categories()
    {
        CategoryID = 8,
        CategoryName = "CategoryName",
    };

    int affected = db.Cmd.Update(c);
    affected = db.Cmd.Update(c, p => p.CategoryName);
    affected = await db.Cmd.UpdateAsync(c);

    IList<Categories> catagories = client.Cmd.Select<Categories>();
    db.Cmd.BatchUpdate(catagories);
    db.Cmd.BatchUpdate(catagories, p => p.CategoryName);
    await db.Cmd.BatchUpdateAsync(catagories);
     
    db.Commit();
}

Insert Operations

using (var db = ionixFactory.CreateTransactionalDbClient())
{
    Categories c = new Categories()
    {
        CategoryID = 0,
        CategoryName = "CategoryName",
    };

    int affected = db.Cmd.Insert(c);
    affected = await db.Cmd.InsertAsync(c);

    IList<Categories> catagories = client.Cmd.Select<Categories>();
    categories.ForEach((item) => item.CategoryID = 0);
    db.Cmd.BatchInsert(catagories);
    await db.Cmd.BatchInsertAsync(catagories);
     
    db.Commit();
}

Upsert Operations

using (var db = ionixFactory.CreateTransactionalDbClient())
{
    Categories c = new Categories()
    {
        CategoryID = 0,
        CategoryName = "CategoryName",
    };

    int affected = db.Cmd.Upsert(c);
    affected = db.Cmd.Upsert(c, p => p.CategoryName);
    affected = await db.Cmd.UpsertAsync(c);

    IList<Categories> catagories = client.Cmd.Select<Categories>();
    categories.ForEach((item) => item.CategoryID = 0);
    db.Cmd.BatchUpsert(catagories);
    db.Cmd.BatchUpsert(catagories, p => p.CategoryName);
    await db.Cmd.BatchUpsertAsync(catagories);
     
    db.Commit();
}

Delete Operations

using (var db = ionixFactory.CreateDbClient())
{
    Categories c = new Categories()
    {
        CategoryID = 3
    };

    int affected = db.Cmd.Delete(c);
    affected = await db.Cmd.DeleteAsync(c);
}

BulkCopy Operations

const int length = 1000000;
List<Region> list = new List<Region>(length);
for (int j = 0; j < length; ++j)
     list.Add(new Region() { RegionID = 1000 + j, RegionDescription = "dl" + j });

using (var db = ionixFactory.CreateDbClient())
{
    db.Cmd.BulkCopy(list);
    async db.Cmd.BulkCopyAsync(list); 
}

Which databases are supported?

Sql Server, Oracle, PostgreSQL (with migration / code-first approach) and SQLite.

You can check the ionix.DataTests project out for more details.

What about performance?

Maybe It's not perfectly accurate, but the picture gives you some insight about ionix's Performance;

ionix vs Entity Framework

("EF_Test" is Entity Framework' s Tests, "ionix_Tests" is ionix.Data' s Tests. All the tests run on Sql Server 2012)

Product 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 netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  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.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on ionix.Data.SQLite:

Package Downloads
SQLog

Log everything to SQLite, not to a simple text file.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.0.7 1,115 10/30/2018
2.0.5 1,213 6/5/2018
2.0.3 1,336 5/2/2018
2.0.2 1,347 5/2/2018
2.0.1 1,575 12/29/2017
2.0.0 1,479 12/7/2017
1.0.0 1,141 4/7/2016

Some nuget packages updated.