Tuesday, December 25, 2018

Why Wrapping DBContext in UOW is bad


Why wrapping DBContext in User defined UOW is a bad idea?

DBContext is a UOW, wrapping this UOW inside another UOW is bad idea because it does not provide any value or advantage. It is redundant and increases the complexity of the Codebase. It provides to Value of doing so.

Downside is only this that this provides no Value. All Complex Domain intensive scenarios can be done by pattern no, 4 and 5. There is no use of defining User Defined Class for UOW. Pattern 4 and 5 are more than enough.

Repository Pattern no. 4 and 5 encapsulate the DBContext inside them. We should use it for UOW inside the custom defined classes for pattern 4 and 5.

No comments:

Post a Comment