Quando ho aggiornato "Microsoft.EntityFrameworkCore.Tools.DotNet" alla versione "1.1.0-preview4" , il framework di entità si è fermato per generare migrazioni.
Errore:
dotnet : System.ArgumentException: Identity value generation cannot be used
for the property 'UID' on entity type 'SomeEntity' because the property type is
'Guid'. Identity value generation can only be used with signed integer properties.
La soluzione è sbarazzarsi di attributo [DatabaseGenerated (DatabaseGeneratedOption.Identity)]
[Key]
// [DatabaseGenerated(DatabaseGeneratedOption.Identity)] <-- remove this
public Guid UID { get; set; }
e aggiorna il costruttore del modello
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
// add this:
modelBuilder.Entity<SomeEntity>().Property(p => p.UID).ValueGeneratedOnAdd();
}