thilemann
thilemann

Reputation: 397

Entity Framework data access

I'm currently working on a team project where we have to work with the Entity Framework. Our WinForms application is using the MVC design pattern, and by that fact, we are not quite sure how to work with the data.

  1. Would it be best just to work with the context and make changes to this?
  2. Or, would it be best to create a DataManager class that is part of the Controller, and then create the appropriate (needed) methods within this class? For example, if we need a method that returns all persons with IDs between x and y, then we would make this method in the DataManager that takes x and y as input.

Thank you for your suggestions.

Upvotes: 0

Views: 203

Answers (1)

Maxim Zabolotskikh
Maxim Zabolotskikh

Reputation: 3347

I personally like repository pattern. There are a lot more less formal samples with code on the web. One of "bonus" advantages is that you can make a fake implementation that does not go to DB and use it for unit testing.

But there is no one best approach to this problem.

Upvotes: 1

Related Questions