OceanBase数据有2种模式MySql和Oracle
SqlSugarCore
SqlSugarClient db = new SqlSugarClient(new ConnectionConfig() { DbType = DbType.OceanBase, ConnectionString = "server=localhost;Database=SqlSugar4xTest;Uid=root;Pwd=haosql;", IsAutoCloseConnection = true, //个别特殊的数据库需要禁用Nvarchar MoreSettings=new ConnMoreSettings() { DisableNarvchar=true } });
Optimizer Hints 可以用在SQL语句中改变执行计划,懂这个的用 , 不懂的就先不要看了
db.Queryable<Order>().Hints("/*+ ... */").ToList();
SqlSugar.OceanBaseForOracleCore //需要升级到5.1.4.92-preview14+ SqlSugarCore
//安装odbc驱动 ob-connector-odbc-2.0.8.2-win64.msi
字符串
Driver={OceanBase ODBC 2.0 Driver};Server=172.19.9.9;
Port=2883;Database=XIR_TRD;User=XIR_TRD@Xpia2C6G#obtest:1650773680;
Password=aaAA11%%;Option=3;
//程序启动时加上只要执行一次 InstanceFactory.CustomAssemblies = new System.Reflection.Assembly[] { typeof(OceanBaseForOracleProvider).Assembly }; //创建db SqlSugarClient db = new SqlSugarClient(new ConnectionConfig() { DbType = DbType.OceanBaseForOracle, ConnectionString = "...", IsAutoCloseConnection = true, //个别特殊的数据库需要禁用Nvarchar //MoreSettings=new ConnMoreSettings() { DisableNarvchar=true } }); //需要升级到5.1.4.92-preview+
建议用雪花ID作主键
https://www.donet5.com/Home/Doc?typeId=2561
如果非要用的话并发有些不友好,并发高可能需要自已加锁返回ID
看Oracle文档,自增用法一样
2016 © donet5.comApache Licence 2.0