Lcpi.EntityFrameworkCore.DataProvider.LcpiOleDb 6.0.1.200

Install-Package Lcpi.EntityFrameworkCore.DataProvider.LcpiOleDb -Version 6.0.1.200
dotnet add package Lcpi.EntityFrameworkCore.DataProvider.LcpiOleDb --version 6.0.1.200
<PackageReference Include="Lcpi.EntityFrameworkCore.DataProvider.LcpiOleDb" Version="6.0.1.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.1.200
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Lcpi.EntityFrameworkCore.DataProvider.LcpiOleDb, 6.0.1.200"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. 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.1.200

// Install Lcpi.EntityFrameworkCore.DataProvider.LcpiOleDb as a Cake Tool
#tool nuget:?package=Lcpi.EntityFrameworkCore.DataProvider.LcpiOleDb&version=6.0.1.200
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

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...

Related packages

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.1.200 65 12/23/2021
6.0.1.100 57 12/20/2021

* Portable PDB.