Why did you use `INorthwindDbContext` which strong dependence on ef core?
ElderJames opened this issue · comments
I don't think interfaces should depend on concrete implementations.
We can use the interfaces like repository for every domain object or any entity store component without any orm dependency.
read this a few hours ago and I see both sides. The original author talks about this here . regarding not using repositories.
in short, what I understand is yes the core of the project is dependent on EF core. but not any particular database.
Yes, I'm with you the core of the project should not have a reference to an ORM. Or Any Persistence Technology Right? The Core of the Project should be aware that a Persistence is happening but not how. I would even go so far a to say the core of the project should not even be aware of the concept of databases.
Now with this being said what is the damage. Can you switch to a different database Yes if it is a database that works with efCore the just switch it out, and if it does not work with Ef core then that can also be oK also because DB set is fully virtual and you can just overwrite the Methods of dbSet?
may the fix should be a CQCS split the reads and the writes. and have the core of the project call something other than a database.
@ElderJames - I also don't like this weird interface. But here it's all about simplicity as he said many times. Just to show how this approach can help in a long term. In my own project I have repos instead of IContext. Here it really doesn't matter.
NorthwindTraders is just idea - not a production ready solution. Just add any extra blocks you need.
I think @lukehammer and @rafalschmidt97 covered it well. Thanks!