Artur S.
Artur S.

Reputation: 334

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?

Upvotes: 2

Views: 1423

Answers (2)

Mark Rotteveel
Mark Rotteveel

Reputation: 109079

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.

Upvotes: 2

cincura.net
cincura.net

Reputation: 4150

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.

Upvotes: 3

Related Questions