-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Data seeding can leave tracked entities in the context #16025
Comments
Note for triage: the issue here is that the context instance is still tracking seed data after @samueleresca As a workaround for now you can move your using (var context = new TestCatalogContext(options))
{
context.Database.EnsureCreated();
}
using (var context = new TestCatalogContext(options))
{
var sut = new ItemRepository(context);
sut.Add(entity);
await sut.UnitOfWork.SaveEntitiesAsync();
} |
@ajcvickers thanks for the workaround |
@ajcvickers fb84697 changed creating a new |
I'm getting this error in some unit tests using the last preview version (
3.0.0-preview5.19227.1
) of theMicrosoft.EntityFrameworkCore.InMemory
package. The same issue is not reproducible with the stable version2.2.4
.The exception that I'm receiving:
Steps to reproduce
The following repository contains the issue: EFCore.IssueSamples
To reproduce the error execute inside the project folder:
If you revert to the
2.2.4
version, all the packages it works fine.I've tested both the
int
type and theGuid
type.Further technical details
EF Core version: (found in project.csproj or packages.config)
Database Provider:
Microsoft.EntityFrameworkCore.InMemory
Operating system: MacOSX
IDE: VsCode
The text was updated successfully, but these errors were encountered: