实体添加示例包括简单的添加操作、简单的启用事务添加示例、相同实体与不同实体的批量添加操作、多个相同实体与不同实体间不同的操作。
CreateContents
添加——简单示例无事务(非严谨性数据)
示例
LotteryModel lottery = new LotteryModel(){
Lot_code = "07,02,01,04,06",
Lot_guess = "test2",
Lot_platform = 3,
Lot_type = 0,
Lot_title = "测试8",
SetDate = DateTime.Now
};
lottery.Create();
Lot_code = "07,02,01,04,06",
Lot_guess = "test2",
Lot_platform = 3,
Lot_type = 0,
Lot_title = "测试8",
SetDate = DateTime.Now
};
lottery.Create();
添加——简单示例启用事务(严谨性数据)
示例
LotteryModel lottery = new LotteryModel(){
Lot_code = "07,02,01,04,06",
Lot_guess = "test2",
Lot_platform = 3,
Lot_type = 0,
Lot_title = "测试8",
SetDate = DateTime.Now
};
lottery.Create(true);
Lot_code = "07,02,01,04,06",
Lot_guess = "test2",
Lot_platform = 3,
Lot_type = 0,
Lot_title = "测试8",
SetDate = DateTime.Now
};
lottery.Create(true);
添加——多个相同实体批量操作
示例
Sql[] sql = new Sql[2];
sql[0] = new Sql(){
Parameter = new LotteryModel[]{
new LotteryModel()
{
Lot_code = "07,02,01,04,06",
Lot_guess = "test2",
Lot_platform = 3,
Lot_type = 0,
Lot_title = "测试8",
SetDate=DateTime.Now
}
}
};
sql[1] = new Sql()
{
Parameter = new LotteryModel[]{
new LotteryModel()
{
Lot_code = "07,02,01,04,06",
Lot_platform = 3,
Lot_type = 0,
Lot_title = "测试9"
}
}
};
LotteryModel lottery = new LotteryModel();
lottery.Create(true, sql);
sql[0] = new Sql(){
Parameter = new LotteryModel[]{
new LotteryModel()
{
Lot_code = "07,02,01,04,06",
Lot_guess = "test2",
Lot_platform = 3,
Lot_type = 0,
Lot_title = "测试8",
SetDate=DateTime.Now
}
}
};
sql[1] = new Sql()
{
Parameter = new LotteryModel[]{
new LotteryModel()
{
Lot_code = "07,02,01,04,06",
Lot_platform = 3,
Lot_type = 0,
Lot_title = "测试9"
}
}
};
LotteryModel lottery = new LotteryModel();
lottery.Create(true, sql);
添加——多个不同实体批量添加
示例
Sql[] sql = new Sql[2];
sql[0] = new Sql()
{
Parameter = new LotteryModel[]{
new LotteryModel()
{
Lot_code = "07,02,01,04,06",
Lot_guess = "test2",
Lot_platform = 3,
Lot_type = 0,
Lot_title = "测试8",
SetDate=DateTime.Now
}
}
};
sql[1] = new Sql(){
Parameter = new CodeModel[]{
new CodeModel()
{
Content=27,
Bewrite="320132004"
}
}
};
//使用基类进行操作
DataObject.DataFactory.DataModulemodule = new DataObject.DataFactory.DataModule();
module.Create(true, sql);
sql[0] = new Sql()
{
Parameter = new LotteryModel[]{
new LotteryModel()
{
Lot_code = "07,02,01,04,06",
Lot_guess = "test2",
Lot_platform = 3,
Lot_type = 0,
Lot_title = "测试8",
SetDate=DateTime.Now
}
}
};
sql[1] = new Sql(){
Parameter = new CodeModel[]{
new CodeModel()
{
Content=27,
Bewrite="320132004"
}
}
};
//使用基类进行操作
DataObject.DataFactory.DataModulemodule = new DataObject.DataFactory.DataModule();
module.Create(true, sql);
添加——多个相同实体实现不同操作
示例
Sql[] sql = new Sql[2];
//添加
sql[0] = new Sql(){
Parameter = new LotteryModel[]{
new LotteryModel()
{
Lot_code = "07,02,01,04,06",
Lot_guess = "test2",
Lot_platform = 3,
Lot_type = 0,
Lot_title = "测试8",
SetDate=DateTime.Now
}
}
};
//更新
sql[1] = new Sql()
{
ExecuteType= DataObject.Enum.ExecuteType.Update,
Parameter = new LotteryModel[]{
new LotteryModel()
{
Lot_id=100,
Lot_code = "07,02,01,04,06",
Lot_platform = 3,
Lot_type = 0,
Lot_title = "测试9"
}
}
};
LotteryModel lottery = new LotteryModel();
lottery.Create(true, sql);
//添加
sql[0] = new Sql(){
Parameter = new LotteryModel[]{
new LotteryModel()
{
Lot_code = "07,02,01,04,06",
Lot_guess = "test2",
Lot_platform = 3,
Lot_type = 0,
Lot_title = "测试8",
SetDate=DateTime.Now
}
}
};
//更新
sql[1] = new Sql()
{
ExecuteType= DataObject.Enum.ExecuteType.Update,
Parameter = new LotteryModel[]{
new LotteryModel()
{
Lot_id=100,
Lot_code = "07,02,01,04,06",
Lot_platform = 3,
Lot_type = 0,
Lot_title = "测试9"
}
}
};
LotteryModel lottery = new LotteryModel();
lottery.Create(true, sql);
添加——多个不同实体进行不同操作
示例
Sql[] sql = new Sql[2];
//添加彩票
sql[0] = new Sql()
{
Parameter = new LotteryModel[]{
new LotteryModel()
{
Lot_code = "07,02,01,04,06",
Lot_guess = "test2",
Lot_platform = 3,
Lot_type = 0,
Lot_title = "测试8",
SetDate=DateTime.Now
}
}
};
//修改防伪码
sql[1] = new Sql(){
ExecuteType = DataObject.Enum.ExecuteType.Update,
Parameter = new CodeModel[]{
new CodeModel()
{
C_id=1,
Content=27,
Bewrite="320132004"
}
}
};
//使用基类进行操作
DataObject.DataFactory.DataModulemodule = new DataObject.DataFactory.DataModule();
module.Create(true, sql);
//添加彩票
sql[0] = new Sql()
{
Parameter = new LotteryModel[]{
new LotteryModel()
{
Lot_code = "07,02,01,04,06",
Lot_guess = "test2",
Lot_platform = 3,
Lot_type = 0,
Lot_title = "测试8",
SetDate=DateTime.Now
}
}
};
//修改防伪码
sql[1] = new Sql(){
ExecuteType = DataObject.Enum.ExecuteType.Update,
Parameter = new CodeModel[]{
new CodeModel()
{
C_id=1,
Content=27,
Bewrite="320132004"
}
}
};
//使用基类进行操作
DataObject.DataFactory.DataModulemodule = new DataObject.DataFactory.DataModule();
module.Create(true, sql);