I'm trying to do following:
1. Create entity and attach it to EntityManager. I do attach it to manager ONLY for the reason that I need verification to work. VerificationManager can't be assigned to detached entity.
this.MailItem = new SYSMailItem
{
MailItemGKey = Guid.NewGuid(),
SenderKey = (this.SecurityService.User as UserPrincipal).UserKey
};
this.EntityManager.AddEntity(this.MailItem);
2. When I'm done with editing entity - I need to pass it into my "manager" to save it.
this.EntityManager.RemoveEntity(this.MailItem, true);
this.MailService.SendMail(this.MailItem...
3. Inside MailService I'm trying to attach this entity back to another manager for saving:
this.entityManager.AddEntity(mailItem);
I'm getting following error:
This entity already belongs to or was previously associated with another EntityManager and has a temporary key defined by that EntityManager
Yes, sure. I agree with this message :)
But how do I detach so it can be attached to different manager?