Skip to content

Instantly share code, notes, and snippets.

@renatogroffe
Created February 12, 2017 16:06
Show Gist options
  • Save renatogroffe/f4d27505b73ae7beb138ae4657e07033 to your computer and use it in GitHub Desktop.
Save renatogroffe/f4d27505b73ae7beb138ae4657e07033 to your computer and use it in GitHub Desktop.
using Microsoft.EntityFrameworkCore;
namespace APICotacoes
{
public class CotacoesContext : DbContext
{
public DbSet<Cotacao> Cotacoes { get; set; }
public CotacoesContext(DbContextOptions<CotacoesContext> options) :
base(options)
{
}
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Entity<Cotacao>().HasKey(c => c.Sigla);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment