This commit is contained in:
sunkaixuan
2017-03-04 00:54:19 +08:00
parent 2f3b6b0991
commit ac52b65e10
6 changed files with 34 additions and 9 deletions

13
OrmTest/Config.cs Normal file
View File

@@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OrmTest
{
public class Config
{
public static string ConnectionString = "server=.;uid=sa;pwd=sasa;database=SqlSugar4XTest";
}
}

View File

@@ -27,12 +27,19 @@ namespace OrmTest.ExpressionTest
public void Q2()
{
ExpressionContext contet = new ExpressionContext();
SqlSugarClient db = new SqlSugarClient(new SystemTablesConfig() { ConnectionString="x" ,DbType= DbType.SqlServer });
db.Queryable<Student, School>((st,sc)=> new object[] {
JoinType.Left,st.SchoolId==sc.Id
});
using (var db = GetInstance())
{
var list = db.Queryable<Student, School>((st, sc) => new object[] {
JoinType.Left,st.SchoolId==sc.Id
}).ToList();
}
}
public SqlSugarClient GetInstance()
{
SqlSugarClient db = new SqlSugarClient(new SystemTablesConfig() { ConnectionString = Config.ConnectionString, DbType = DbType.SqlServer });
return db;
}
}
}

View File

@@ -43,6 +43,7 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Config.cs" />
<Compile Include="ExpressionTest\ExpTestBase.cs" />
<Compile Include="ExpressionTest\Field.cs" />
<Compile Include="ExpressionTest\Join.cs" />