2

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?

Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197
Artur S.
  • 185
  • 3
  • 15

2 Answers2

3

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.

cincura.net
  • 4,130
  • 16
  • 40
  • Excellent! That was precisely what I was looking for! Also, since the database I am working with uses non-conventional EF Core nomenclature, I had to manually set the foreign keys with attribs... – Artur S. May 05 '20 at 17:47
2

The GENERATED BY DEFAULT AS IDENTITY was indeed introduced in Firebird 3.

According to the discussion on the firebird-net-provider Google Group in Problems with boolean properties?, only Firebird 3 is supported for EF Core 3.1.

I'm not sure if there is an option that will suppress generating an identity column, but likely this wouldn't be the only compatibility issue.

Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197