Förberett för övergång till entity framework
This commit is contained in:
25
GreadyPoang.DataLayer/Database/DataContext.cs
Normal file
25
GreadyPoang.DataLayer/Database/DataContext.cs
Normal file
@ -0,0 +1,25 @@
|
||||
using GreadyPoang.EntityLayer;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace GreadyPoang.DataLayer.Database
|
||||
{
|
||||
public class DataContext : DbContext
|
||||
{
|
||||
public DataContext(DbContextOptions<DataContext> options) : base(options)
|
||||
{
|
||||
|
||||
}
|
||||
//public DbSet<User> Users => Set<User>();
|
||||
public DbSet<Participant> Participants { get; set; }
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
base.OnModelCreating(modelBuilder);
|
||||
modelBuilder.Entity<Participant>().HasData(
|
||||
new Participant { ParticipantId = 1, FirstName = "John", LastName = "Doe", Email = "John.Doe@gmail.com" },
|
||||
new Participant { ParticipantId = 2, FirstName = "Jane", LastName = "Black", Email = "jb@gmail.com" },
|
||||
new Participant { ParticipantId = 3, FirstName = "Mary", LastName = "White", Email = "mw@gmail.com" }
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user