using Microsoft.EntityFrameworkCore; namespace Inventory.Core { public class InventoryContext : DbContext { public DbSet Devices { get; set; } public InventoryContext(DbContextOptions options) : base(options) { } protected override void OnModelCreating(ModelBuilder modelBuilder) { modelBuilder.Entity() .HasIndex(d => d.HardwareIdentifier) .IsUnique(); } } }