Lcpi.EntityFrameworkCore.DataProvider.LcpiOleDb 6.0.12.200

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

// Install Lcpi.EntityFrameworkCore.DataProvider.LcpiOleDb as a Cake Tool
#tool nuget:?package=Lcpi.EntityFrameworkCore.DataProvider.LcpiOleDb&version=6.0.12.200                

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

  1. NET6 (Windows)
  2. Entity Framework Core v6.0
  3. Firebird v3.0.8
  4. LCPI ADO.NET Provider for OLE DB
  5. 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...
Product Compatible and additional computed target framework versions.
.NET net6.0-windows7.0 is compatible.  net7.0-windows 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
6.0.27.100 167 3/7/2024
6.0.21.201 206 9/1/2023
6.0.21.200 152 8/16/2023
6.0.21.100 169 8/14/2023
6.0.12.200 360 1/5/2023
6.0.12.100 301 12/26/2022
6.0.8.100 458 8/21/2022
6.0.7.100 432 8/9/2022
6.0.1.200 371 12/23/2021
6.0.1.100 302 12/20/2021

* Now uses lcpi.data.oledb v1.25.4.4606