ionix.Data.Oracle
2.0.6
dotnet add package ionix.Data.Oracle --version 2.0.6
NuGet\Install-Package ionix.Data.Oracle -Version 2.0.6
<PackageReference Include="ionix.Data.Oracle" Version="2.0.6" />
paket add ionix.Data.Oracle --version 2.0.6
#r "nuget: ionix.Data.Oracle, 2.0.6"
// Install ionix.Data.Oracle as a Cake Addin #addin nuget:?package=ionix.Data.Oracle&version=2.0.6 // Install ionix.Data.Oracle as a Cake Tool #tool nuget:?package=ionix.Data.Oracle&version=2.0.6
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;
("EF_Test" is Entity Framework' s Tests, "ionix_Tests" is ionix.Data' s Tests. All the tests run on Sql Server 2012)
Product | Versions 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. |
-
.NETStandard 2.0
- ionix.Data (>= 2.0.6)
- ionix.Utils (>= 2.0.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Some nuget packages updated.