You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
class Foo {
public int Id {get; set;}
//other field
[NotMapper]
public stringNotTouch {get; set;}
}
List<Foo> items;
//initialize the list
using (var transaction = context.Database.BeginTransaction()) {
//here the field stringNotTouch has value, id is 0
context.BulkInsert(itemList, , new BulkConfig { SetOutputIdentity = true });
//here the field stringNotTouch has _no_ value, but id is valid
transaction.Commit();
}
Is it a bug?
The text was updated successfully, but these errors were encountered:
Not classic bug, but we could say it's unusual behavior.
What happens here is that when in BulkConfig only SetOutputIdentity = True, entity list is reload from Db and that's why NotMapped Properties are null.
However there is also PreserveInsertOrder property and when both are set then list will be updated from Db and as a consequence NotMapped Properties will keep their values.
So if you have NotMapped Properties and want to keep their values just set this Config also.
In README is more info about order by setting Id-s of entities when PreserveInsertOrder is used.
UPDATE
PreserveInsertOrder as of v5 is true by defualt in BulkConfig.
Hi,
Let me explain with an Example.
Is it a bug?
The text was updated successfully, but these errors were encountered: