Entity Framework 6 , Should I use repository pattern?

entity-framework entity-framework-6 repository-pattern

Question

I'm still having trouble with it because Entity Framework is new to me. There are so many various instances and explanations that I'm at a loss as to what to do.

I've got a couple inquiries:

I followed a pattern in my present application, which includes:

  • Database Pattern
  • (Above) Unit of Work

I am announcing a NEW Unit Of Work for each from. Therefore, just the linked items are changed when I save my modifications.

I am writing my methods inside the Repository for each class for sophisticated business logics. For instance:

  • One approach is to move an item from one inventory location to another, then reduce the number at the original location, etc. - Or even trickier tasks that read from various tables and write to numerous tables.

But I just now learned that Entity Framework 6.0:

  1. Unit Of Work DbContext
  2. REPOSITORY is equivalent to DbSet.

So, here are the inquiries:

  1. Should I Declare a New DBContext For Each Form And Operation To Keep The Transactions In The Local Context (Form And Operation )?
    1. How am I going to change the methods in my repository?

Thanks

1
2
11/27/2014 3:40:49 PM

Accepted Answer

ZZZ_tmp
1
11/27/2014 4:32:27 PM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow