I am quite new to Entity Framework, and still struggling to solve it.So many different examples and explanations that i can't figure out what to do ?
I have a few questions :
In my current application I used a pattern which consist of :
- Repository Pattern
- (On top of )Unit Of Work
For each from , I am declaring a NEW Unit Of Work .So when I make a Savechanges, only the related items are affected.
For complex business logics , I am writing my methods inside the Repository for each class For example :
- One method for : Remove one item from one inventory location , move it to another location and then decrease the quantity at the old location, etc... -Or much more complex jobs, which reads from different tables and write to many tables.
However recently I found out that by Entity Framework 6.0 :
- DbContext = Unit Of Work
- DbSet is equivalent to REPOSITORY
So the questions are :
- Should i use ONE DBCONTEXT ,or declare a new for each form/operation so the transactions remain in the local context ( form/operation =
- How will I replace the methods in my the repository ?
Thanks