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-issue-importer opened this issue Jul 5, 2019 · 5 comments
Closed

Comments

@firebird-issue-importer
Copy link

@firebird-issue-importer firebird-issue-importer commented Jul 5, 2019

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-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Jul 5, 2019

Commented by: @cincuranet

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

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Jul 5, 2019

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-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Jul 5, 2019

Commented by: @cincuranet

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

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Jul 5, 2019

Commented by: Henning Hassmann (henning)

It works now. Thanks for your help

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Jul 5, 2019

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
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants