public PartyCustomAttributeValue UpdatePartyCustomAttriuteValue(PartyCustomAttribute partyCustomAttribute,PartyX party,string value)
{
Contract.Requires(partyCustomAttribute != null && party != null, "Provided entities can not be null");
Contract.Requires(partyCustomAttribute.Id >= 0 && party.Id >= 0, "Provided entitities must have a permanent ID");
Contract.Ensures(Contract.Result<PartyCustomAttributeValue>() != null && Contract.Result<PartyCustomAttributeValue>().Id >= 0, "No entity is persisted!");
var entity = new PartyCustomAttributeValue();
using (IUnitOfWork uow = this.GetUnitOfWork())
{
IRepository<PartyCustomAttributeValue> repo = uow.GetRepository<PartyCustomAttributeValue>();
entity = repo.Get(item => item.Party.Id == party.Id && item.CustomAttribute.Id == partyCustomAttribute.Id).FirstOrDefault();
entity.Value = value;
repo.Put(entity); // Merge is required here!!!!
uow.Commit();
entity = repo.Reload(entity);
}
return (entity);
}