ProjectContact/Contact Unit of work

Dec 27, 2008 at 8:06 AM
Hi Tim,

First of all, let me thank you for this excellent book. I am having a problem with ProjectContact and contact using the same unit of work.

in SaveProjectContact - ProjectService.cs you have this like of code:
        = contact.Contact;
a call to ProjectService.unitOfWork.Commit() should call the persist methods on the desired entity.

This isn't behaving as expected which is to be able to persist both of those Entities using a single UniteOfWork.  I figured it is an easy fix, but I am unable to figure out the source of the problem.

Please Help,

Thank you,
Jan 2, 2009 at 2:29 PM

A little "persistance" pays off.
contactRepository is passed in the project service unit of work.  when we call ContactService to get a contact a new id is generated.
I just called contactRepository set unit of work and passed it the Project Service's unit of work to make sure they park of the same unit of work before any performing operation.