60
1
using System;
2
using System.Collections.Generic;
3
using System.Linq;
4
using Microsoft.EntityFrameworkCore;
5
6
7
public class BloggingContext : DbContext
8
{
9
public DbSet<Blog> Blogs { get; set; }
10
public DbSet<Post> Posts { get; set; }
11
12
// The following configures EF to create a Sqlite database file as `C:\blogging.db`.
13
// For Mac or Linux, change this to `/tmp/blogging.db` or any other absolute path.
14
protected override void OnConfiguring(DbContextOptionsBuilder options)
15
=> options.UseSqlServer(@"Server=.\SQLEXPRESS;Database=SchoolDB;Trusted_Connection=True;");
16
17
protected override void OnModelCreating(ModelBuilder modelBuilder)
18
{
19
base.OnModelCreating(modelBuilder);
20
}
21
22
}
23
24
public class Blog
Cached Result