mirror of
https://gitee.com/ccnetcore/Yi
synced 2026-04-02 07:06:37 +08:00
配置文件开关,数据库读写分离
This commit is contained in:
@@ -4,14 +4,16 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Model.ModelFactory;
|
||||
using Yi.Framework.Model.Models;
|
||||
|
||||
namespace Yi.Framework.Model.DbInit
|
||||
{
|
||||
public class DataSeed
|
||||
{
|
||||
public async static Task SeedAsync(DbContext _Db)
|
||||
public async static Task SeedAsync(IDbContextFactory _DbFactory)
|
||||
{
|
||||
var _Db= _DbFactory.ConnWriteOrRead(Common.Enum.WriteAndReadEnum.Write);
|
||||
if (!_Db.Set<user>().Any())
|
||||
{
|
||||
await _Db.Set<user>().AddAsync(new user
|
||||
|
||||
Reference in New Issue
Block a user