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
"Beside the same database name, the model must also be the same. This means that in case of an own implementation of IModelCacheKeyFactory, it's Create-Method must return "equal" objects."
thanks!
Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
ID: c95e5c7e-882f-76f7-5301-2a5d1ede39d3
Version Independent ID: 8754aa99-67a7-98ac-a51e-0ba995f96414
Unfortunately when adding a second entity from the inherited class when a first entity was created in the base class gives the following error since the ID of the entity being added is being set to 1 which already exists:
System.InvalidOperationException: 'The instance of entity type 'OperationsSchedule' cannot be tracked because another instance with the same key value for {'OperationsScheduleID'} is already being tracked. When attaching existing entities, ensure that only one entity instance with a given key value is attached. Consider using 'DbContextOptionsBuilder.EnableSensitiveDataLogging' to see the conflicting key values.'
I have created a cut down sample application here:
I am finding when using an in memory database and I create data in the base context database it doesnt exist in the inherited context database,
This is a problem as I am using a Base BLL which is using the base context and an inherited BLL using the inherited context.
The following stack overflow question explains the issue but is there any workaround?
https://stackoverflow.com/questions/48437528/multi-context-inmemory-database
"Beside the same database name, the model must also be the same. This means that in case of an own implementation of IModelCacheKeyFactory, it's Create-Method must return "equal" objects."
thanks!
Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
The text was updated successfully, but these errors were encountered: