This commit is contained in:
sunkaixuna
2021-04-25 20:47:32 +08:00
parent 644a67b58c
commit 445d7e5dca
2 changed files with 20 additions and 12 deletions

View File

@@ -46,6 +46,10 @@ namespace OrmTest
{
db.ConfigQuery.SetTable<DataDictionary>(it => it.Code, it => it.Name, type, it => it.Type == type);
}
db.ConfigQuery.SetTable<Order>(it => it.Id, it => it.Name, "01", it => it.Id > 1);
db.ConfigQuery.SetTable<Order>(it => it.Id, it => it.Name, "02", it => it.Id > 2);
db.ConfigQuery.SetTable<Order>(it => it.Id, it => it.Name, null);
}
@@ -59,12 +63,7 @@ namespace OrmTest
db.DbMaintenance.TruncateTable("DataDictionary");
if (!db.ConfigQuery.Any())
{
db.ConfigQuery.SetTable<Order>(it => it.Id, it => it.Name, "01", it => it.Id > 1);
db.ConfigQuery.SetTable<Order>(it => it.Id, it => it.Name, "02", it => it.Id > 2);
db.ConfigQuery.SetTable<Order>(it => it.Id, it => it.Name, null);
}
var list = db.Queryable<OrderItem>().Select(it => new OrderItem
{
ItemId = it.ItemId.SelectAll(),

View File

@@ -14,11 +14,22 @@ namespace OrmTest
{
Console.WriteLine("");
Console.WriteLine("#### SimpleClient Start ####");
var rep1=new Repository<C1Table>();
rep1.GetList();
var rep2 = rep1.ChangeRepository<Repository<C2Table>>();
new C1Service().Test();
Console.WriteLine("#### SimpleClient End ####");
}
public class C1Service : Repository<C1Table>
{
public void Test()
{
base.GetList();
base.ChangeRepository<C2Service>().GetList();
}
}
public class C2Service : Repository<C2Table>
{
}
public class Repository<T> : SimpleClient<T> where T : class, new()
{
@@ -31,7 +42,6 @@ namespace OrmTest
{
ConfigId=1,
DbType = SqlSugar.DbType.SqlServer,
InitKeyType = InitKeyType.Attribute,
IsAutoCloseConnection = true,
ConnectionString = Config.ConnectionString
},
@@ -39,7 +49,6 @@ namespace OrmTest
{
ConfigId="2",
DbType = SqlSugar.DbType.SqlServer,
InitKeyType = InitKeyType.Attribute,
IsAutoCloseConnection = true,
ConnectionString = Config.ConnectionString2
}