Add initial database context and first entity
This commit is contained in:
27
Data/DiaryDBContext.cs
Normal file
27
Data/DiaryDBContext.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using Diary.Component.Entry.Repository;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace Diary.Data
|
||||
{
|
||||
|
||||
public interface IDiaryDBContext
|
||||
{
|
||||
DbSet<Entry> Entries { get; set; }
|
||||
}
|
||||
|
||||
public class DiaryDBContext : DbContext, IDiaryDBContext
|
||||
{
|
||||
public DbSet<Entry> Entries { get; set; }
|
||||
|
||||
public DiaryDBContext(DbContextOptions<DiaryDBContext> options) : base(options)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder builder)
|
||||
{
|
||||
base.OnModelCreating(builder);
|
||||
|
||||
builder.ApplyConfiguration(new EntryConfiguration());
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user