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
I am not sure if this is a bug or just a lack of a good error message. You specified an ID column and by default EF will identify it as a primary key column with ValuedGenerated=OnAdd. The extension library is expecting the database to generate the id column. In order to fix this error you would have to specify the "[DatabaseGenerated(DatabaseGeneratedOption.None)]" attribute on the Id column as shown below. I will do some more research on this issue in order to validate my initial findings and I will report what I discover.
public class ProductWithExistingKey { [DatabaseGenerated(DatabaseGeneratedOption.None)] public Guid Id { get; set; } public string Name { get; set; } public decimal Price { get; set; } public ProductWithExistingKey() { Id = Guid.NewGuid(); } }
First, thanks for getting back to me so fast....
My expectation (which could be off-base)... is that code that works with DbSet<Entity>.Add(entity) followed by a Context.SaveChanges(). would work without changes when moving to Bulk operations on the same set of entities (into the same Db, etc...)
Yup.... This works,,, but replace back the one line and it fails.... interesting to say the least....
Describe the bug
Create a class with a Guid ID that is pre-loaded... it can not be bulk inserted...
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Items are bulk inserted.
Screenshots
Desktop (please complete the following information):
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: