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
Virtualize RepositoryBase methods #66
Comments
Hi @ngruson, It's not about the method implementations only, but also the namespaces used within the "RepositoryBase". The Also, we should have a new project for tests, something like This is my stand initially, @ardalis may have a different opinion. PS. We have to refactor the test infrastructure here. It's in our backlog for some time. We should have the following:
[EDIT] |
Hi @fiseni Just to clarify further: Shall I make a PR to virtualize these methods in both the EF Core and EF6 RepositoryBase classes? |
Lets' first wait to merge the existing PR, and fix the EF6 project properly. Once we sort that out, then you can create an additional PR for these changes. Sounds OK? For now, please use your own fully implemented Repository (you may just copy the implementations and update them as you wish). Anyhow, the |
The methods of base repositories now are marked as virtual in |
Implemented in |
What do you feel about making the methods in RepositoryBase.cs virtual?
I ran into a NullReferenceException when unit testing my concrete EF6 implementation of the repository with a mocked DbContext.
I'm not able to mock the Entry method of DbContext because the constructor of DbEntityEntry is not public.
If UpdateAsync was virtual in RepositoryBase, I could override it in my concrete repository:
SetModified in my concrete repository:
I would need a protected property to get to the DbContext.
In this setup, I'm able to unit test my concrete repository without issues.
The text was updated successfully, but these errors were encountered: