Last active
June 24, 2020 21:11
-
-
Save httpmurilo/35dedda9078cd57183131a3ae4ab1de3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Faculdade.Api.Model; | |
using Microsoft.EntityFrameworkCore; | |
namespace Faculdade.Api.Data | |
{ | |
public class DataContext: DbContext | |
{ | |
public DataContext(DbContextOptions<DataContext> options) : base(options) | |
{} | |
public DbSet<Autor> Autores {get;set;} | |
protected override void OnModelCreating(ModelBuilder builder) | |
{ | |
builder.Entity<Autor>().HasData( | |
new Autor() | |
{ | |
Id = 1, | |
Nome = "Antony Lima", | |
Curso = "Direito Criminal" | |
}, | |
new Autor() | |
{ | |
Id = 2, | |
Nome = "Marcos Cesar", | |
Curso = "Ciências" | |
}, | |
new Autor() | |
{ | |
Id = 3, | |
Nome = "Renato Souza", | |
Curso = "Matemática" | |
} | |
); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment