Skip to content

Instantly share code, notes, and snippets.


dcomartin/DbContext.cs Secret

Created Feb 24, 2021
What would you like to do?
public class Product
public string Sku { get; set; }
public int Received { get; set; }
public int Shipped { get; set; }
public class ProductDbContext : DbContext
public DbSet<Product> Products { get; set; }
protected override void OnModelCreating(ModelBuilder modelBuilder)
modelBuilder.Entity<Product>().HasKey(x => x.Sku);
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment