Be Cn
0
Q:

how to set unique constraint from EF core

protected override void OnModelCreating(ModelBuilder builder)
{
    builder.Entity<User>()
        .HasIndex(u => u.Email)
        .IsUnique();
}
0

New to Communities?

Join the community