Setup ef core tools and sqlite database with some entities
This commit is contained in:
24
BrightGlimmer.Data/SqliteDatabaseContext.cs
Normal file
24
BrightGlimmer.Data/SqliteDatabaseContext.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using BrightGlimmer.Data.Domain;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace BrightGlimmer.Data
|
||||
{
|
||||
public class SqliteDatabaseContext : DbContext
|
||||
{
|
||||
public SqliteDatabaseContext(DbContextOptions<SqliteDatabaseContext> options)
|
||||
: base(options)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
modelBuilder.Entity<Student>()
|
||||
.HasMany(x => x.Phones);
|
||||
}
|
||||
|
||||
public DbSet<Student> Students { get; set; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user