- 优化 FreeSql.DbContext 构造方法,方便注入使用;

This commit is contained in:
28810
2019-10-23 12:32:47 +08:00
parent aaed0334b8
commit cb55f51413
4 changed files with 47 additions and 27 deletions

View File

@ -8,13 +8,16 @@ namespace dbcontext_01
public class SongContext : DbContext
{
public SongContext() : base() { }
public SongContext(IFreeSql fsql) : base(fsql, null) { }
public DbSet<Song> Songs { get; set; }
public DbSet<Tag> Tags { get; set; }
//protected override void OnConfiguring(DbContextOptionsBuilder builder) {
// builder.UseFreeSql(dbcontext_01.Startup.Fsql);
//}
protected override void OnConfiguring(DbContextOptionsBuilder builder)
{
builder.UseFreeSql(Startup.Fsql);
}
}