Lcpi.EntityFrameworkCore.DataProvider.LcpiOleDb
6.0.8.100
See the version list below for details.
dotnet add package Lcpi.EntityFrameworkCore.DataProvider.LcpiOleDb --version 6.0.8.100
NuGet\Install-Package Lcpi.EntityFrameworkCore.DataProvider.LcpiOleDb -Version 6.0.8.100
<PackageReference Include="Lcpi.EntityFrameworkCore.DataProvider.LcpiOleDb" Version="6.0.8.100" />
paket add Lcpi.EntityFrameworkCore.DataProvider.LcpiOleDb --version 6.0.8.100
#r "nuget: Lcpi.EntityFrameworkCore.DataProvider.LcpiOleDb, 6.0.8.100"
// Install Lcpi.EntityFrameworkCore.DataProvider.LcpiOleDb as a Cake Addin
#addin nuget:?package=Lcpi.EntityFrameworkCore.DataProvider.LcpiOleDb&version=6.0.8.100
// Install Lcpi.EntityFrameworkCore.DataProvider.LcpiOleDb as a Cake Tool
#tool nuget:?package=Lcpi.EntityFrameworkCore.DataProvider.LcpiOleDb&version=6.0.8.100
EF Core Provider for «LCPI ADO.NET Provider for OLE DB» v6.0
Lcpi.EntityFrameworkCore.DataProvider.LcpiOleDb is an open source EF Core provider for «LCPI ADO.NET Provider for OLE DB».
Currently it allows you to interact with Firebird v3 via Microsoft Entity Framework Core v6.0.
Attention
This provider doesn't look and doesn't feel like any other Entity Framework Core provider.
Target platform
- NET6 (Windows)
- Entity Framework Core v6.0
- Firebird v3.0.8
- LCPI ADO.NET Provider for OLE DB
- LCPI.IBProvider v5
Example of usage
////////////////////////////////////////////////////////////////////////////////
//Please use correct TargetPlatform: net6.0-windows7.0
////////////////////////////////////////////////////////////////////////////////
using Microsoft.EntityFrameworkCore;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
////////////////////////////////////////////////////////////////////////////////
//TEST TABLE
/*
RECREATE TABLE DBMS
(
ID BIGINT GENERATED BY DEFAULT AS IDENTITY CONSTRAINT PK_DBMS PRIMARY KEY,
NAME VARCHAR(32) CHARACTER SET UTF8,
DESCRIPTION VARCHAR(128) CHARACTER SET UTF8
);
*/
////////////////////////////////////////////////////////////////////////////////
const string c_Dbms_Name ="Firebird";
const string c_Dbms_Descr="Of course I still \u2764 you! \ud83d\ude04"; // ;)
////////////////////////////////////////////////////////////////////////////////
try
{
//---------------------------- INSERT
Console.WriteLine("Inserting new record...");
using var db=new MyDbContext();
using var tr=db.Database.BeginTransaction();
var newRecord=new DatabaseServer{ Name=c_Dbms_Name, Description=c_Dbms_Descr };
db.DatabaseServers!.Add(newRecord);
db.SaveChanges();
var newRecordID=newRecord.ID;
Console.WriteLine("newRecordID: {0}",newRecordID);
//---------------------------- SELECT
Console.WriteLine("Selecting inserted record...");
var recs
=db
.DatabaseServers
.Where(r => r.Description!.Length==c_Dbms_Descr.Length && r.ID==newRecordID)
.Select(r => new {ServerName=r.Name!});
int nRec=0;
foreach(var r in recs)
{
++nRec;
Console.WriteLine("{0}. {1}",nRec, r.ServerName);
}//foreach r
if(nRec!=1)
throw new ApplicationException("Oh sh...");
//---------------------------- DELETE
Console.WriteLine("Deleting inserted record...");
db.DatabaseServers.Remove(newRecord);
db.SaveChanges();
tr.Commit();
}
catch(Exception ex)
{
for(var e=ex;e!=null;e=e.InnerException)
{
Console.WriteLine
("--- ERROR: {0}\n{1}",
e.Source,
e.Message);
}//for e
}//catch
// Cleanup ....
GC.Collect();
GC.WaitForPendingFinalizers();
////////////////////////////////////////////////////////////////////////////////
sealed class MyDbContext:DbContext
{
private const string c_CnStr
="provider=LCPI.IBProvider.5;"
+"location=inet4://localhost/d:\\database\\ram\\ibp_test_fb30_d3.gdb;"
+"dbclient_type=fb.direct;"
+"user id=SYSDBA;"
+"password=masterkey;"
+"auto_commit=true;"
+"wchars_in_utf8_symbol=2;"; //Enabling full UTF8 support. Because we can.
public DbSet<DatabaseServer>? DatabaseServers { get; set; }
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
optionsBuilder.UseLcpiOleDb(c_CnStr);
}
};//class DbContext
////////////////////////////////////////////////////////////////////////////////
[Table("DBMS")]
sealed class DatabaseServer
{
[Key]
public long ID { get; set; }
[Column("NAME", TypeName="VARCHAR(32) CHARACTER SET UTF8")]
public string? Name { get; set; }
[Column("DESCRIPTION", TypeName="VARCHAR(128) CHARACTER SET UTF8")]
public string? Description { get; set; }
};//class DatabaseServer
////////////////////////////////////////////////////////////////////////////////
Output:
Inserting new record...
newRecordID: 8
Selecting inserted record...
1. Firebird
Deleting inserted record...
Related packages
- The underlying ADO.NET provider is lcpi.data.oledb.
- The underlying OLE DB provider is LCPI.IBProvider.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0-windows7.0 is compatible. net7.0-windows was computed. net8.0-windows was computed. |
-
net6.0-windows7.0
- lcpi.data.oledb (= 1.25.2.4577)
- Microsoft.EntityFrameworkCore (= 6.0.8)
- Microsoft.EntityFrameworkCore.Abstractions (= 6.0.8)
- Microsoft.EntityFrameworkCore.Relational (= 6.0.8)
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 |
---|---|---|
6.0.27.100 | 95 | 3/7/2024 |
6.0.21.201 | 172 | 9/1/2023 |
6.0.21.200 | 127 | 8/16/2023 |
6.0.21.100 | 143 | 8/14/2023 |
6.0.12.200 | 330 | 1/5/2023 |
6.0.12.100 | 277 | 12/26/2022 |
6.0.8.100 | 430 | 8/21/2022 |
6.0.7.100 | 400 | 8/9/2022 |
6.0.1.200 | 341 | 12/23/2021 |
6.0.1.100 | 272 | 12/20/2021 |
* Local evaluation now ignores the cast to System.Object
- It helps avoid the loss of type information
- The same behavior has been existing in the SQL translator since beginning
* Migration to EFCore 6.0.8