Update demo

This commit is contained in:
sunkaixuan 2019-06-02 15:31:27 +08:00
parent 62bbe8954d
commit 1a9bbf927b
88 changed files with 215 additions and 84 deletions

View File

@ -40,15 +40,17 @@ namespace OrmTest
}
});
//if no exist create datebase
//If no exist create datebase
db.DbMaintenance.CreateDatabase();
//Use db
//Use db query
var dt = db.Ado.GetDataTable("select 1");
//create tables
//Create tables
db.CodeFirst.InitTables(typeof(OrderItem),typeof(Order));
var id = db.Insertable(new Order() { Name = "order1", CustomId = 1, Price = 0, CreateTime = DateTime.Now }).ExecuteReturnIdentity();
//Insert data
db.Insertable(new OrderItem() { OrderId = id, Price = 0, CreateTime=DateTime.Now }).ExecuteCommand();
Console.WriteLine("#### SqlSugarClient End ####");

View File

@ -30,16 +30,16 @@ namespace OrmTest
}
});
//by entity
db.Deleteable<Order>().Where(new Order() { Id = 1 }).ExecuteCommand();
db.Deleteable<Order>().Where(new Order() { Id = 1111 }).ExecuteCommand();
//by primary key
db.Deleteable<Order>().In(1).ExecuteCommand();
//by primary key array
db.Deleteable<Order>().In(new int[] { 1, 2 }).ExecuteCommand();
db.Deleteable<Order>().In(new int[] { 1111, 2222 }).ExecuteCommand();
//by expression
db.Deleteable<Order>().Where(it => it.Id == 1).ExecuteCommand();
db.Deleteable<Order>().Where(it => it.Id == 11111).ExecuteCommand();
Console.WriteLine("#### Deleteable End ####");

View File

@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OrmTest
{
public class Demo7_Ado
{
public static void Init()
{
}
}
}

View File

@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OrmTest
{
public class Demo8_Saveable
{
public static void Init()
{
}
}
}

View File

@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OrmTest
{
public class Demo9_EntityMain
{
public static void Init()
{
}
}
}

View File

@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OrmTest
{
public class DemoA_DbMain
{
public static void Init()
{
}
}
}

View File

@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OrmTest
{
public class DemoB_Aop
{
public static void Init()
{
}
}
}

View File

@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OrmTest
{
public class DemoF_Utilities
{
public static void Init()
{
}
}
}

View File

@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OrmTest
{
public class DemoG_SimpleClient
{
public static void Init()
{
}
}
}

View File

@ -6,7 +6,7 @@ using System.Text;
namespace OrmTest
{
public class Democ_GobalFilter
public class DemoC_GobalFilter
{
public static void Init()
{

View File

@ -18,11 +18,20 @@ namespace OrmTest
Demo0_SqlSugarClient.Init();
Demo1_Queryable.Init();
Demo2_Updateable.Init();
Democ_GobalFilter.Init();
DemoD_DbFirst.Init();
DemoE_CodeFirst.Init();
Demo3_Insertable.Init();
Demo4_Deleteable.Init();
Demo5_SqlQueryable.Init();
Demo6_Queue.Init();
Demo7_Ado.Init();
Demo8_Saveable.Init();
Demo9_EntityMain.Init();
DemoA_DbMain.Init();
DemoB_Aop.Init();
DemoC_GobalFilter.Init();
DemoD_DbFirst.Init();;
DemoE_CodeFirst.Init();
DemoF_Utilities.Init();
DemoG_SimpleClient.Init();
//Unit test
//NewUnitTest.Init();

View File

@ -56,10 +56,17 @@
<Compile Include="Demo\Demo4_Deleteable.cs" />
<Compile Include="Demo\Demo5_SqlQueryable.cs" />
<Compile Include="Demo\Demo6_Queue.cs" />
<Compile Include="Demo\Demo7_Ado.cs" />
<Compile Include="Demo\Demo8_Saveable.cs" />
<Compile Include="Demo\Demo9_EntityMain.cs" />
<Compile Include="Demo\DemoA_DbMain.cs" />
<Compile Include="Demo\DemoB_Aop.cs" />
<Compile Include="Demo\DemoC_GobalFilter.cs" />
<Compile Include="Demo\Demo1_Queryable.cs" />
<Compile Include="Demo\DemoD_DbFirst.cs" />
<Compile Include="Demo\DemoE_CodeFirst.cs" />
<Compile Include="Demo\DemoF_Utilities.cs" />
<Compile Include="Demo\DemoG_SimpleClient.cs" />
<Compile Include="Models\Custom.cs" />
<Compile Include="Models\Mapper.cs" />
<Compile Include="Models\Tree.cs" />
@ -68,85 +75,85 @@
<Compile Include="Models\OrderItem.cs" />
<Compile Include="Demo\Demo0_SqlSugarClient.cs" />
<Compile Include="Models\ViewOrder.cs" />
<Compile Include="OldTest\BugTest\Bug2.cs" />
<Compile Include="OldTest\BugTest\BugModels\AccountsModel.cs" />
<Compile Include="OldTest\BugTest\BugModels\ClientsModel.cs" />
<Compile Include="OldTest\BugTest\BugModels\ExposureModel.cs" />
<Compile Include="OldTest\BugTest\BugModels\h5linkpassloginfo.cs" />
<Compile Include="OldTest\BugTest\BugModels\JewelsModel.cs" />
<Compile Include="OldTest\BugTest\BugModels\LevelSettingModel.cs" />
<Compile Include="OldTest\BugTest\BugModels\logtype.cs" />
<Compile Include="OldTest\BugTest\BugModels\tLogonHistoryModel.cs" />
<Compile Include="OldTest\BugTest\BugModels\VipAccountsModel.cs" />
<Compile Include="OldTest\BugTest\BugModels\VipBenefitsModel.cs" />
<Compile Include="OldTest\BugTest\BugModels\TStock.cs" />
<Compile Include="OldTest\BugTest\BugModels\TTempStock.cs" />
<Compile Include="OldTest\BugTest\BugModels\VMaterialInfo.cs" />
<Compile Include="OldTest\Demos\H_Queue.cs" />
<Compile Include="OldTest\Demos\I_InsertOrUpdate.cs" />
<Compile Include="OldTest\Demos\J_Debugger.cs" />
<Compile Include="OldTest\Demos\K_MultiClient.cs" />
<Compile Include="OldTest\Models\Brand.cs" />
<Compile Include="OldTest\BugTest\Bug1.cs" />
<Compile Include="_OldTest\BugTest\Bug2.cs" />
<Compile Include="_OldTest\BugTest\BugModels\AccountsModel.cs" />
<Compile Include="_OldTest\BugTest\BugModels\ClientsModel.cs" />
<Compile Include="_OldTest\BugTest\BugModels\ExposureModel.cs" />
<Compile Include="_OldTest\BugTest\BugModels\h5linkpassloginfo.cs" />
<Compile Include="_OldTest\BugTest\BugModels\JewelsModel.cs" />
<Compile Include="_OldTest\BugTest\BugModels\LevelSettingModel.cs" />
<Compile Include="_OldTest\BugTest\BugModels\logtype.cs" />
<Compile Include="_OldTest\BugTest\BugModels\tLogonHistoryModel.cs" />
<Compile Include="_OldTest\BugTest\BugModels\VipAccountsModel.cs" />
<Compile Include="_OldTest\BugTest\BugModels\VipBenefitsModel.cs" />
<Compile Include="_OldTest\BugTest\BugModels\TStock.cs" />
<Compile Include="_OldTest\BugTest\BugModels\TTempStock.cs" />
<Compile Include="_OldTest\BugTest\BugModels\VMaterialInfo.cs" />
<Compile Include="_OldTest\Demos\H_Queue.cs" />
<Compile Include="_OldTest\Demos\I_InsertOrUpdate.cs" />
<Compile Include="_OldTest\Demos\J_Debugger.cs" />
<Compile Include="_OldTest\Demos\K_MultiClient.cs" />
<Compile Include="_OldTest\Models\Brand.cs" />
<Compile Include="_OldTest\BugTest\Bug1.cs" />
<Compile Include="Models\TestTree.cs" />
<Compile Include="OldTest\Models\VendorAndBrand.cs" />
<Compile Include="OldTest\Demos\F_VersionValidation.cs" />
<Compile Include="OldTest\Demos\G_Mapper.cs" />
<Compile Include="OldTest\Demos\H_ExtEntity.cs" />
<Compile Include="OldTest\Models\CapitalEntity.cs" />
<Compile Include="_OldTest\Models\VendorAndBrand.cs" />
<Compile Include="_OldTest\Demos\F_VersionValidation.cs" />
<Compile Include="_OldTest\Demos\G_Mapper.cs" />
<Compile Include="_OldTest\Demos\H_ExtEntity.cs" />
<Compile Include="_OldTest\Models\CapitalEntity.cs" />
<Compile Include="Config.cs" />
<Compile Include="OldTest\Demos\5_CodeFirst.cs" />
<Compile Include="OldTest\Demos\6_ComplexModel.cs" />
<Compile Include="OldTest\Demos\7_Filter.cs" />
<Compile Include="OldTest\Demos\8_JoinSql.cs" />
<Compile Include="OldTest\Demos\5_DbFirst.cs" />
<Compile Include="OldTest\Demos\4_Delete.cs" />
<Compile Include="OldTest\Demos\9_Aop.cs" />
<Compile Include="OldTest\Demos\B_SharedConnection.cs" />
<Compile Include="OldTest\Demos\C_ExtSqlFun.cs" />
<Compile Include="OldTest\Demos\Z_DemoBase.cs" />
<Compile Include="OldTest\Demos\3_Insert.cs" />
<Compile Include="OldTest\Demos\1_Query.cs" />
<Compile Include="OldTest\Demos\2_Update.cs" />
<Compile Include="OldTest\Demos\A_MasterSlave.cs" />
<Compile Include="OldTest\Demos\D_QueryableView.cs" />
<Compile Include="OldTest\Demos\E_Attribute.cs" />
<Compile Include="OldTest\Models\DataTestInfo.cs" />
<Compile Include="OldTest\Models\DataTestInfo2.cs" />
<Compile Include="OldTest\Models\Enum.cs" />
<Compile Include="OldTest\Models\ViewModelStudent.cs" />
<Compile Include="OldTest\OldTestMain.cs" />
<Compile Include="OldTest\PerformanceTesting\PerformanceBase.cs" />
<Compile Include="OldTest\PerformanceTesting\SqlSugarPerformance.cs" />
<Compile Include="OldTest\T4\SugarTemplate1.cs" />
<Compile Include="OldTest\T4\SugarTemplate2.cs">
<Compile Include="_OldTest\Demos\5_CodeFirst.cs" />
<Compile Include="_OldTest\Demos\6_ComplexModel.cs" />
<Compile Include="_OldTest\Demos\7_Filter.cs" />
<Compile Include="_OldTest\Demos\8_JoinSql.cs" />
<Compile Include="_OldTest\Demos\5_DbFirst.cs" />
<Compile Include="_OldTest\Demos\4_Delete.cs" />
<Compile Include="_OldTest\Demos\9_Aop.cs" />
<Compile Include="_OldTest\Demos\B_SharedConnection.cs" />
<Compile Include="_OldTest\Demos\C_ExtSqlFun.cs" />
<Compile Include="_OldTest\Demos\Z_DemoBase.cs" />
<Compile Include="_OldTest\Demos\3_Insert.cs" />
<Compile Include="_OldTest\Demos\1_Query.cs" />
<Compile Include="_OldTest\Demos\2_Update.cs" />
<Compile Include="_OldTest\Demos\A_MasterSlave.cs" />
<Compile Include="_OldTest\Demos\D_QueryableView.cs" />
<Compile Include="_OldTest\Demos\E_Attribute.cs" />
<Compile Include="_OldTest\Models\DataTestInfo.cs" />
<Compile Include="_OldTest\Models\DataTestInfo2.cs" />
<Compile Include="_OldTest\Models\Enum.cs" />
<Compile Include="_OldTest\Models\ViewModelStudent.cs" />
<Compile Include="_OldTest\OldTestMain.cs" />
<Compile Include="_OldTest\PerformanceTesting\PerformanceBase.cs" />
<Compile Include="_OldTest\PerformanceTesting\SqlSugarPerformance.cs" />
<Compile Include="_OldTest\T4\SugarTemplate1.cs" />
<Compile Include="_OldTest\T4\SugarTemplate2.cs">
<DependentUpon>SugarTemplate.tt</DependentUpon>
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
</Compile>
<Compile Include="OldTest\UnitTest\DataTest.cs" />
<Compile Include="OldTest\UnitTest\Delete.cs" />
<Compile Include="OldTest\UnitTest\EnumTest.cs" />
<Compile Include="OldTest\UnitTest\SqlRemark.cs" />
<Compile Include="OldTest\UnitTest\UnitTestBase.cs" />
<Compile Include="OldTest\UnitTest\ExpressionTest\Field.cs" />
<Compile Include="OldTest\UnitTest\Insert.cs" />
<Compile Include="OldTest\UnitTest\Mapping .cs" />
<Compile Include="OldTest\UnitTest\Query\JoinQuery.cs" />
<Compile Include="OldTest\UnitTest\ExpressionTest\Method.cs" />
<Compile Include="OldTest\UnitTest\ExpressionTest\Select.cs" />
<Compile Include="OldTest\UnitTest\Query\SelectQuery.cs" />
<Compile Include="OldTest\UnitTest\Query\SingleQuery.cs" />
<Compile Include="OldTest\UnitTest\ExpressionTest\Where.cs" />
<Compile Include="OldTest\Models\School.cs" />
<Compile Include="OldTest\Models\Student.cs" />
<Compile Include="_OldTest\UnitTest\DataTest.cs" />
<Compile Include="_OldTest\UnitTest\Delete.cs" />
<Compile Include="_OldTest\UnitTest\EnumTest.cs" />
<Compile Include="_OldTest\UnitTest\SqlRemark.cs" />
<Compile Include="_OldTest\UnitTest\UnitTestBase.cs" />
<Compile Include="_OldTest\UnitTest\ExpressionTest\Field.cs" />
<Compile Include="_OldTest\UnitTest\Insert.cs" />
<Compile Include="_OldTest\UnitTest\Mapping .cs" />
<Compile Include="_OldTest\UnitTest\Query\JoinQuery.cs" />
<Compile Include="_OldTest\UnitTest\ExpressionTest\Method.cs" />
<Compile Include="_OldTest\UnitTest\ExpressionTest\Select.cs" />
<Compile Include="_OldTest\UnitTest\Query\SelectQuery.cs" />
<Compile Include="_OldTest\UnitTest\Query\SingleQuery.cs" />
<Compile Include="_OldTest\UnitTest\ExpressionTest\Where.cs" />
<Compile Include="_OldTest\Models\School.cs" />
<Compile Include="_OldTest\Models\Student.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="OldTest\UnitTest\Setting\Attribute.cs" />
<Compile Include="OldTest\UnitTest\Setting\AutoClose.cs" />
<Compile Include="OldTest\UnitTest\Setting\MapColumn.cs" />
<Compile Include="OldTest\UnitTest\Setting\MapTable.cs" />
<Compile Include="OldTest\UnitTest\Update.cs" />
<Compile Include="_OldTest\UnitTest\Setting\Attribute.cs" />
<Compile Include="_OldTest\UnitTest\Setting\AutoClose.cs" />
<Compile Include="_OldTest\UnitTest\Setting\MapColumn.cs" />
<Compile Include="_OldTest\UnitTest\Setting\MapTable.cs" />
<Compile Include="_OldTest\UnitTest\Update.cs" />
<Compile Include="UnitTest\UCodeFirst.cs" />
<Compile Include="UnitTest\UAdo.cs" />
<Compile Include="UnitTest\Updateable.cs" />
@ -166,9 +173,9 @@
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Content Include="OldTest\DataBase\script.sql" />
<Content Include="OldTest\OtherDll\SyntacticSugar.dll" />
<Content Include="OldTest\T4\SugarTemplate.tt">
<Content Include="_OldTest\DataBase\script.sql" />
<Content Include="_OldTest\OtherDll\SyntacticSugar.dll" />
<Content Include="_OldTest\T4\SugarTemplate.tt">
<Generator>TextTemplatingFileGenerator</Generator>
<LastGenOutput>SugarTemplate2.cs</LastGenOutput>
</Content>

View File

@ -0,0 +1 @@