mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-04-05 17:37:58 +08:00
Update access demo
This commit is contained in:
parent
3640f3a873
commit
d19717ace5
@ -100,6 +100,12 @@
|
|||||||
<Content Include="Test.accdb">
|
<Content Include="Test.accdb">
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
|
<Content Include="x64\SQLite.Interop.dll">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
|
<Content Include="x86\SQLite.Interop.dll">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
</Project>
|
</Project>
|
@ -13,6 +13,7 @@ namespace OrmTest
|
|||||||
public static void Init()
|
public static void Init()
|
||||||
{
|
{
|
||||||
EasyExamples();
|
EasyExamples();
|
||||||
|
AccessAndSqliteTest();
|
||||||
//QueryConditions();
|
//QueryConditions();
|
||||||
JoinTable();
|
JoinTable();
|
||||||
//Async();
|
//Async();
|
||||||
@ -24,6 +25,7 @@ namespace OrmTest
|
|||||||
//ConfiQuery();
|
//ConfiQuery();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private static void ConfiQuery()
|
private static void ConfiQuery()
|
||||||
{
|
{
|
||||||
var db = GetInstance();
|
var db = GetInstance();
|
||||||
@ -297,6 +299,17 @@ namespace OrmTest
|
|||||||
Console.WriteLine("#### Subquery End ####");
|
Console.WriteLine("#### Subquery End ####");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void AccessAndSqliteTest()
|
||||||
|
{
|
||||||
|
var db = GetInstance();
|
||||||
|
var sqlitedb = GetSqliteInstance();
|
||||||
|
db.Queryable<Order>().ToList();
|
||||||
|
sqlitedb.DbMaintenance.CreateDatabase();
|
||||||
|
sqlitedb.CodeFirst.InitTables<Order>();
|
||||||
|
sqlitedb.Queryable<Order>().ToList();
|
||||||
|
db.Queryable<Order>().ToList();
|
||||||
|
}
|
||||||
|
|
||||||
private static void SqlFuncTest()
|
private static void SqlFuncTest()
|
||||||
{
|
{
|
||||||
Console.WriteLine("");
|
Console.WriteLine("");
|
||||||
@ -575,5 +588,23 @@ namespace OrmTest
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
private static SqlSugarClient GetSqliteInstance()
|
||||||
|
{
|
||||||
|
return new SqlSugarClient(new ConnectionConfig()
|
||||||
|
{
|
||||||
|
DbType = SqlSugar.DbType.Sqlite,
|
||||||
|
ConnectionString = "DataSource=/sqlite.db",
|
||||||
|
InitKeyType = InitKeyType.Attribute,
|
||||||
|
IsAutoCloseConnection = true,
|
||||||
|
AopEvents = new AopEvents
|
||||||
|
{
|
||||||
|
OnLogExecuting = (sql, p) =>
|
||||||
|
{
|
||||||
|
Console.WriteLine(sql);
|
||||||
|
Console.WriteLine(string.Join(",", p?.Select(it => it.ParameterName + ":" + it.Value)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
BIN
Src/Asp.Net/AccessTest/x64/SQLite.Interop.dll
Normal file
BIN
Src/Asp.Net/AccessTest/x64/SQLite.Interop.dll
Normal file
Binary file not shown.
BIN
Src/Asp.Net/AccessTest/x86/SQLite.Interop.dll
Normal file
BIN
Src/Asp.Net/AccessTest/x86/SQLite.Interop.dll
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user