当我尝试保存我的实体buzzmate时,我遇到了这个例外:
An entity object cannot be referenced by multiple instances of IEntityChangeTracker.
这是生成此异常的代码:
var p = Session["mayaProfile"] as MayaProfile;
BuzzMate buzzmate = new BuzzMate();
buzzmate.MayaProfile = p;
SocialBuzzCompaign socialcampaign = _buzzService.GetSocialBuzzCompaign(model.socialBuzzCompaignId);
//Ajouter le BuzzMate
buzzmate.SocialBuzzCompaign = socialcampaign;
buzzmate.JoiningStatus = JoiningStatus.Approved;
buzzmate.SelectionType = BuzzMateSelectionType.InvitedByBuzzLeader;
//try
//
_buzzService.AddBuzzMate(buzzmate);
这是 AddBuzzMate 方法:
public void AddBuzzMate(BuzzMate buzzMate)
{
_buzzMateRepository.Insert(buzzMate);
_buzzMateRepository.Save();
}
当我试图拯救嗡嗡声时,我有异常