Skip to content

Instantly share code, notes, and snippets.

@dcomartin
Created October 19, 2017 00:48
Show Gist options
  • Save dcomartin/5e8f1e9c10b65cb946d18a8fc946d074 to your computer and use it in GitHub Desktop.
Save dcomartin/5e8f1e9c10b65cb946d18a8fc946d074 to your computer and use it in GitHub Desktop.
class MyContext : DbContext
{
public DbSet<Car> Cars { get; set; }
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Entity<Car>()
.HasKey(c => new { c.State, c.LicensePlate });
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment