C#C
C#4y ago
36 replies
Cyan

Solution to mixing SQL queries with entity framework entities

Hi guys,

So I have a code base that uses manually written SqlConnection queries AND entity framework entities to read and write to the database.

Now I want to fix the duplicate code and make everything more organized.

I think putting both the sql connection code and entity framework behind repositories in a data project. So the repositories can be reused instead of copy pasting SqlConnection code with adjustments which is the case now.

The question is: what is the most effective way to organize the SqlConnection code and entity framework code so it can be reused and avoids duplication.
Was this page helpful?