|
|
@@ -335,62 +335,117 @@ namespace Business.Quartz
|
|
|
if (ic_itemListAdd.Count > 0)
|
|
|
{
|
|
|
//await _ic_item.InsertManyAsync(ic_itemListAdd);
|
|
|
- await _businessDbContext.ic_item.BulkInsertAsync(ic_itemListAdd, options => options.AutoMapOutputDirection = false);
|
|
|
+ await _businessDbContext.ic_item.BulkInsertAsync(ic_itemListAdd, options =>
|
|
|
+ {
|
|
|
+ options.InsertKeepIdentity = true;
|
|
|
+ options.InsertIfNotExists = true;
|
|
|
+ options.AutoMapOutputDirection = false;
|
|
|
+ });
|
|
|
}
|
|
|
if (ic_itemListUpdate.Count > 0)
|
|
|
{
|
|
|
//await _ic_item.UpdateManyAsync(ic_itemListUpdate);
|
|
|
- await _businessDbContext.ic_item.BulkUpdateAsync(ic_itemListUpdate, options => options.AutoMapOutputDirection = false);
|
|
|
+ await _businessDbContext.ic_item.BulkUpdateAsync(ic_itemListUpdate, options =>
|
|
|
+ {
|
|
|
+ options.InsertKeepIdentity = true;
|
|
|
+ options.AutoMapOutputDirection = false;
|
|
|
+ options.ColumnPrimaryKeyExpression = c => c.Id;
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
if (ic_factory_detailsListAdd.Count > 0)
|
|
|
{
|
|
|
//await _ic_factory_details.InsertManyAsync(ic_factory_detailsListAdd);
|
|
|
- await _businessDbContext.ic_factory_details.BulkInsertAsync(ic_factory_detailsListAdd, options => options.AutoMapOutputDirection = false);
|
|
|
+ await _businessDbContext.ic_factory_details.BulkInsertAsync(ic_factory_detailsListAdd, options =>
|
|
|
+ {
|
|
|
+ options.InsertKeepIdentity = true;
|
|
|
+ options.InsertIfNotExists = true;
|
|
|
+ options.AutoMapOutputDirection = false;
|
|
|
+ });
|
|
|
}
|
|
|
if (ic_factory_detailsListUpdate.Count > 0)
|
|
|
{
|
|
|
//await _ic_factory_details.UpdateManyAsync(ic_factory_detailsListUpdate);
|
|
|
- await _businessDbContext.ic_factory_details.BulkUpdateAsync(ic_factory_detailsListUpdate, options => options.AutoMapOutputDirection = false);
|
|
|
+ await _businessDbContext.ic_factory_details.BulkUpdateAsync(ic_factory_detailsListUpdate, options =>
|
|
|
+ {
|
|
|
+ options.InsertKeepIdentity = true;
|
|
|
+ options.AutoMapOutputDirection = false;
|
|
|
+ options.ColumnPrimaryKeyExpression = c => c.Id;
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
if (ic_item_ieListAdd.Count > 0)
|
|
|
{
|
|
|
//await _ic_item_ie.InsertManyAsync(ic_item_ieListAdd);
|
|
|
- await _businessDbContext.ic_item_ie.BulkInsertAsync(ic_item_ieListAdd, options => options.AutoMapOutputDirection = false);
|
|
|
+ await _businessDbContext.ic_item_ie.BulkInsertAsync(ic_item_ieListAdd, options =>
|
|
|
+ {
|
|
|
+ options.InsertKeepIdentity = true;
|
|
|
+ options.InsertIfNotExists = true;
|
|
|
+ options.AutoMapOutputDirection = false;
|
|
|
+ });
|
|
|
}
|
|
|
if (ic_item_ieListUpdate.Count > 0)
|
|
|
{
|
|
|
//await _ic_item_ie.UpdateManyAsync(ic_item_ieListUpdate);
|
|
|
- await _businessDbContext.ic_item_ie.BulkUpdateAsync(ic_item_ieListUpdate, options => options.AutoMapOutputDirection = false);
|
|
|
+ await _businessDbContext.ic_item_ie.BulkUpdateAsync(ic_item_ieListUpdate, options =>
|
|
|
+ {
|
|
|
+ options.InsertKeepIdentity = true;
|
|
|
+ options.AutoMapOutputDirection = false;
|
|
|
+ options.ColumnPrimaryKeyExpression = c => c.Id;
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
if (ic_item_purListAdd.Count > 0)
|
|
|
{
|
|
|
//await _ic_item_pur.InsertManyAsync(ic_item_purListAdd);
|
|
|
- await _businessDbContext.ic_item_pur.BulkInsertAsync(ic_item_purListAdd, options => options.AutoMapOutputDirection = false);
|
|
|
+ await _businessDbContext.ic_item_pur.BulkInsertAsync(ic_item_purListAdd, options =>
|
|
|
+ {
|
|
|
+ options.InsertKeepIdentity = true;
|
|
|
+ options.InsertIfNotExists = true;
|
|
|
+ options.AutoMapOutputDirection = false;
|
|
|
+ });
|
|
|
}
|
|
|
if (ic_item_purListUpdate.Count > 0)
|
|
|
{
|
|
|
//await _ic_item_pur.UpdateManyAsync(ic_item_purListUpdate);
|
|
|
- await _businessDbContext.ic_item_pur.BulkUpdateAsync(ic_item_purListUpdate, options => options.AutoMapOutputDirection = false);
|
|
|
+ await _businessDbContext.ic_item_pur.BulkUpdateAsync(ic_item_purListUpdate, options =>
|
|
|
+ {
|
|
|
+ options.InsertKeepIdentity = true;
|
|
|
+ options.AutoMapOutputDirection = false;
|
|
|
+ options.ColumnPrimaryKeyExpression = c => c.Id;
|
|
|
+ };
|
|
|
}
|
|
|
|
|
|
if (ic_planListAdd.Count > 0)
|
|
|
{
|
|
|
//await _ic_plan.InsertManyAsync(ic_planListAdd);
|
|
|
- await _businessDbContext.ic_plan.BulkInsertAsync(ic_planListAdd, options => options.AutoMapOutputDirection = false);
|
|
|
+ await _businessDbContext.ic_plan.BulkInsertAsync(ic_planListAdd, options =>
|
|
|
+ {
|
|
|
+ options.InsertKeepIdentity = true;
|
|
|
+ options.InsertIfNotExists = true;
|
|
|
+ options.AutoMapOutputDirection = false;
|
|
|
+ });
|
|
|
}
|
|
|
if (ic_planListUpdate.Count > 0)
|
|
|
{
|
|
|
//await _ic_plan.UpdateManyAsync(ic_planListUpdate);
|
|
|
- await _businessDbContext.ic_plan.BulkUpdateAsync(ic_planListUpdate, options => options.AutoMapOutputDirection = false);
|
|
|
+ await _businessDbContext.ic_plan.BulkUpdateAsync(ic_planListUpdate, options =>
|
|
|
+ {
|
|
|
+ options.InsertKeepIdentity = true;
|
|
|
+ options.AutoMapOutputDirection = false;
|
|
|
+ options.ColumnPrimaryKeyExpression = c => c.Id;
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
if (ext_xrefList.Count > 0)
|
|
|
{
|
|
|
//await _ext_xref.UpdateManyAsync(ext_xrefList);
|
|
|
- await _businessExtDbContext.ext_xref.BulkInsertAsync(ext_xrefList, options => options.AutoMapOutputDirection = false);
|
|
|
+ await _businessExtDbContext.ext_xref.BulkInsertAsync(ext_xrefList, options =>
|
|
|
+ {
|
|
|
+ options.InsertKeepIdentity = true;
|
|
|
+ options.InsertIfNotExists = true;
|
|
|
+ options.AutoMapOutputDirection = false;
|
|
|
+ });
|
|
|
}
|
|
|
}
|
|
|
}
|