Browse Source

Update demo

pull/38/MERGE
sunkaixuan 1 year ago
parent
commit
e5faaa5922
  1. 36
      Src/Asp.Net/OracleTest/Demo/DemoE_CodeFirst.cs

36
Src/Asp.Net/OracleTest/Demo/DemoE_CodeFirst.cs

@ -56,24 +56,24 @@ namespace OrmTest
db.Queryable<CodeFirstNoUpper>().LeftJoin<CodeFirstNoUpper>((s, y) => s.Id == y.Id)
.Select((s, y) => y).ToList();
SqlSugarClient db2 = new SqlSugarClient(new ConnectionConfig()
{
DbType = DbType.Oracle,
ConnectionString = Config.ConnectionString3,
InitKeyType = InitKeyType.Attribute,
IsAutoCloseConnection = true,
MoreSettings=new ConnMoreSettings()
{
EnableOracleIdentity=true
}
});
db2.Aop.OnLogExecuting = (s, p) => Console.WriteLine(s);
db2.CodeFirst.InitTables<CodeFIrstadfa>();
var id = db2.Insertable(new CodeFIrstadfa() { Id = 1, Name = "a" }).ExecuteReturnIdentity();
var id11 = db2.Insertable(new CodeFIrstadfa() { Id = 1, Name = "a" }).ExecuteReturnIdentityAsync().GetAwaiter().GetResult();
var id111 = db2.Insertable(new CodeFIrstadfa() { Id = 1, Name = "a" }).ExecuteReturnBigIdentityAsync().GetAwaiter().GetResult();
var id1111 = db2.Insertable(new CodeFIrstadfa() { Id = 1, Name = "a" }).ExecuteReturnBigIdentity();
var id2 = db2.Insertable(new List<CodeFIrstadfa>() { new CodeFIrstadfa() { Id = 1, Name = "a" }, new CodeFIrstadfa() { Id = 1, Name = "a" } }).ExecuteReturnIdentity();
//SqlSugarClient db2 = new SqlSugarClient(new ConnectionConfig()
//{
// DbType = DbType.Oracle,
// ConnectionString = Config.ConnectionString3,
// InitKeyType = InitKeyType.Attribute,
// IsAutoCloseConnection = true,
// MoreSettings=new ConnMoreSettings()
// {
// EnableOracleIdentity=true
// }
//});
//db2.Aop.OnLogExecuting = (s, p) => Console.WriteLine(s);
//db2.CodeFirst.InitTables<CodeFIrstadfa>();
//var id = db2.Insertable(new CodeFIrstadfa() { Id = 1, Name = "a" }).ExecuteReturnIdentity();
//var id11 = db2.Insertable(new CodeFIrstadfa() { Id = 1, Name = "a" }).ExecuteReturnIdentityAsync().GetAwaiter().GetResult();
//var id111 = db2.Insertable(new CodeFIrstadfa() { Id = 1, Name = "a" }).ExecuteReturnBigIdentityAsync().GetAwaiter().GetResult();
//var id1111 = db2.Insertable(new CodeFIrstadfa() { Id = 1, Name = "a" }).ExecuteReturnBigIdentity();
//var id2 = db2.Insertable(new List<CodeFIrstadfa>() { new CodeFIrstadfa() { Id = 1, Name = "a" }, new CodeFIrstadfa() { Id = 1, Name = "a" } }).ExecuteReturnIdentity();
Console.WriteLine("#### CodeFirst end ####");
}
}

Loading…
Cancel
Save