Context lifetime management in repository and unit of work pattern
问题 I have a repositories implemented with unitOfWork pattern and share a context. i have a service layer on top of these repositories. which has multiple services. When ever i instantiate a service class - unitOfWork instance is created. But many times these services methods call each other and sometimes operate on common session objects. Which causes a problem of the same entity being tracked by multiple contexts or more specifically - An entity object cannot be referenced by multiple instances