Search code examples
c#entity-framework.net-corefirebirdfirebird-.net-provider

Net Core 3.1, Firebird 2.5 and FB.EF 7.5


I currently have an ASP.NET Core 3.1 project and I'm using FirebirdSql.EntityFrameowrk.Core.Firebird v7.5.0.

When trying to update the database from a simple migration with a primary key and a string column

public class TB_CUSTOMER
{
    [Key]
    public int ID_CUSTOMER{ get; set; }
    public string NAME{ get; set; }
}

However, when I push a database update, I get a "Token Unknown" error. This is due to how EF is creating the SQL query:

CREATE TABLE "TB_CUSTOMER" (
    "ID_CUSTOMER" INTEGER GENERATED BY DEFAULT AS IDENTITY NOT NULL,
    "NAME" BLOB SUB_TYPE TEXT,
    CONSTRAINT "PK_TB_CUSTOMER" PRIMARY KEY ("ID_CUSTOMER")
);

It seems GENERATED BY is a syntax brought for Firebird 3.0 (which I cannot use due to technical issues with third-party software). I couldn't find any information on whether I can use NET Core 3.1 (And FB.EF 7.5.0) with FB 2.5. Is it possible, or is it a lost cause?

If it is possible, how can I specify the version of FB the EF is supposed to expect?


Solution

  • At the moment Firebird <3 is not supported. But if you carefully choose features, you can make it work. One option is to disable identity and use sequence and trigger.