-
Notifications
You must be signed in to change notification settings - Fork 12
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
GrpcServerApplicationFactoryBase does not replace/remove DbContextOptions<TContext> #1
Comments
@whighsmith could you take a look at last comment and check if this is what you did? |
@kkoziarski Yes... except I also removed the call to
since the call to services.Replace in this case only "Adds" a descriptor (.Remove isn't called internally) and the InMemory DbContext will be added in the subclass (implementation of) GrpcServerApplicationFactoryBase when this.ConfigureTestServices(builder, services); is called. On another note, I have also removed the dependency on DbContext (which moves all above source code to the subclass) out of the base classes all together since this testing infrastructure will be used with microservices and each microservice will have its own database which could mean a microservice could have a persistence layer that does not use DbContext but some other persistence mechanism and database/storage technology. |
@kkoziarski You can also do the following in the subclass:
since replacing DbContextOptions with the InMemoryDatabase option is what you are trying to achieve. |
@whighsmith all are good points. I'm happy to accept your PR when you create it. Otherwise I'll try to do it in an undefined future. |
Had to use the following services.Remove statements in order to completely replace my original DbContext with one that uses InMemoryDatabase.
in
GrpcServerApplicationFactoryBase
awesome solution by the way.. thanks.
The text was updated successfully, but these errors were encountered: