/// <summary> /// 重写的OnConfiguring方法 /// </summary> /// <param name="optionsBuilder"></param> protected override void OnConfiguring(Microsoft.EntityFrameworkCore.DbContextOptionsBuilder optionsBuilder) { base.OnConfiguring(optionsBuilder); MySqlConfig useConfig = ConfigPacker.GetConfigPacker().GetConfig <MySqlConfig>(); optionsBuilder.UseMySql(useConfig.Connectstr); }
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) { base.OnConfiguring(optionsBuilder); //获取配置 SqliteConfig useConfig = ConfigPacker.GetConfigPacker().GetConfig <SqliteConfig>(); optionsBuilder.UseSqlite(useConfig.Connectstr); }
protected override void Prepare(ref string useContectionString) { MongoDBConfig tempConfig = ConfigPacker.GetConfigPacker().GetConfig <MongoDBConfig>(); useContectionString = tempConfig.ConnectStr; }