Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EF Core - Firebird Migration auto-increment problem [DNET884] #813

Closed
firebird-automations opened this issue Jul 5, 2019 · 5 comments
Closed

Comments

@firebird-automations
Copy link

Submitted by: Henning Hassmann (henning)

Hi. I'm testing the migration with EF Core with MSSQL-Server and Firebird 3.0.

I create a new table with a few fields. The key-field has the property .ValueGeneratedOnAdd(), but the key-field in the Firebird database doesn't get an auto-increment during the migration. It works with the MS-SQL-Server correctly.

I use the framework FirebirdSql.EntityFrameworkCore.Firebird version 6.6.0.

modelBuilder.Entity("GenerateCodeFromDB.DB_Modell.TblTest", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnName("ID")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);

b\.Property<DateTime?\>\("Date"\);

b\.Property<string\>\("Name"\)
    \.HasMaxLength\(50\);

b\.Property<int?\>\("Number"\);

b\.HasKey\("Id"\);

b\.ToTable\("tblTest"\);

});

@firebird-automations
Copy link
Author

Commented by: @cincuranet

ValueGeneratedOnAdd is not enough. You should also use UseFirebirdIdentityColumn or UseFirebirdSequenceTrigger which sets the correct ValueGenerationStrategy.

@firebird-automations
Copy link
Author

Commented by: Henning Hassmann (henning)

Is there any example or documentation how to do this and the code should look like?
I tried something like this:
.HasAnnotation("Firebird:UseFirebirdIdentityColumn", FbValueGenerationStrategy.IdentityColumn)

@firebird-automations
Copy link
Author

Commented by: @cincuranet

It's a method. Same as for MSSQL (you don't have to use HasAnnotation).

@firebird-automations
Copy link
Author

Commented by: Henning Hassmann (henning)

It works now. Thanks for your help

@firebird-automations
Copy link
Author

Modified by: @cincuranet

status: Open [ 1 ] => Closed [ 6 ]

resolution: Won't Fix [ 2 ]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants