Skip to content

Instantly share code, notes, and snippets.

@dcomartin
Created February 24, 2021 22:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dcomartin/621a82741d7b1669e4af79dea2014d07 to your computer and use it in GitHub Desktop.
Save dcomartin/621a82741d7b1669e4af79dea2014d07 to your computer and use it in GitHub Desktop.
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