Last active
July 6, 2023 13:29
-
-
Save Guifgr/95d153fbf7b307bf1e7f9ca00d3ecb50 to your computer and use it in GitHub Desktop.
Auto guid to class
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected override void OnModelCreating(ModelBuilder modelBuilder) | |
{ | |
modelBuilder.Entity<CLASSNAME>(entity => | |
{ | |
entity.Property(e => e.Guid).HasDefaultValueSql("uuid()"); | |
entity.HasIndex(e => e.Guid).IsUnique(); | |
}); | |
base.OnModelCreating(modelBuilder); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment