if (SystemConfig.Instance.SortLineDB == SortLineDBEnum.DB2)
{
//DB2
var builder = new DbContextOptionsBuilder<IRCSKCDBContext>();
builder.UseDb2(SystemConfig.Instance.IRCSKCDSN, p => p.SetServerInfo(IBMDBServerType.LUW, IBMDBServerVersion.None));//IRCSKCDSNL表示连接字符串
return new IRCSKCDBContext(builder.Options);
}
else if (SystemConfig.Instance.SortLineDB == SortLineDBEnum.Oracle)
{
//Oracle
var builder = new DbContextOptionsBuilder<IRCSKCDBContext>();
builder.UseOracle(SystemConfig.Instance.IRCSKCDSN, o => o.UseOracleSQLCompatibility("11"));//11表示11g版本12表示12g版本
return new IRCSKCDBContext(builder.Options);
}
else
{
//Sql serve
var builder = new DbContextOptionsBuilder<IRCSKCDBContext>();
//builder.UseSqlServer(SystemConfig.Instance.IRCSKCDSN, b => b.CommandTimeout(40).UseRowNumberForPaging());//CommandTimeout设置,默认30秒
builder.UseSqlServer(SystemConfig.Instance.IRCSKCDSN, b => b.UseRowNumberForPaging());
return new IRCSKCDBContext(builder.Options);
}
//连接字符串
<IRCSKCDSN>Server=127.0.0.1; Database=IRCSTESTDB;User ID=sa;Password=qaz;Max Pool Size=512;</IRCSKCDSN>