I have 2 EF Core databases and one of them does have a table with a GUID as its primary key. I've never had any problems with running migrations but since I try to run migrations from my Azure Devops pipeline i do get an error.
I used the following code to create the script in my Azure pipeline:
- script: 'dotnet ef migrations script --idempotent --output migrations.sql --project "".csproj --context ""'
displayName: Create EF migration Script
And when I try to run it, I get the following error in my Azure Devops pipeline:
System.ArgumentException: Identity value generation cannot be used for the property 'id' on entity type '"" (Dictionary<string, object>)' because the property type is 'Guid'. Identity value generation can only be used with signed integer properties.
I tried to use the same script for the database that uses int as its primary key but there he has no problem with running the migration.
I also tried to remove [DatabaseGenerated(DatabaseGeneratedOption.Identity)] from my GUID PK and added
modelBuilder.Entity<users>().Property(p => p.id).ValueGeneratedOnAdd();
in my modelbuilder. But this resulted in the same error.