Issue Details (XML | Word | Printable)

Key: DNET-884
Type: Bug Bug
Status: Closed Closed
Resolution: Won't Fix
Priority: Major Major
Assignee: Jiri Cincura
Reporter: Henning Hassmann
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
.NET Data provider

EF Core - Firebird Migration auto-increment problem

Created: 05/Jul/19 05:28 AM   Updated: 05/Jul/19 11:21 AM
Component/s: ADO.NET Provider
Affects Version/s: 6.6.0.0
Fix Version/s: None

Environment: Windows 8.1, Visual Studio 2019 (16.1.5), Firebird 3.0-Database


 Description  « Hide
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");
});

 All   Comments   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Jiri Cincura added a comment - 05/Jul/19 05:56 AM
ValueGeneratedOnAdd is not enough. You should also use UseFirebirdIdentityColumn or UseFirebirdSequenceTrigger which sets the correct ValueGenerationStrategy.

Henning Hassmann added a comment - 05/Jul/19 06:19 AM - edited
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)

Jiri Cincura added a comment - 05/Jul/19 06:22 AM
It's a method. Same as for MSSQL (you don't have to use HasAnnotation).

Henning Hassmann added a comment - 05/Jul/19 11:04 AM
It works now. Thanks for your help