Skip to content

Instantly share code, notes, and snippets.

@dcomartin
Created Feb 24, 2021
Embed
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)
{
base.OnModelCreating(modelBuilder);
modelBuilder.Entity<Product>().HasKey(x => x.Sku);
}
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
base.OnConfiguring(optionsBuilder);
optionsBuilder.UseInMemoryDatabase("Demo");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment