BExIS.Dlm.Services.Party.PartyRelationshipTypeManager.UpdatePartyTypePair C# (CSharp) Метод

UpdatePartyTypePair() публичный Метод

public UpdatePartyTypePair ( PartyTypePair entity ) : PartyTypePair
entity BExIS.Dlm.Entities.Party.PartyTypePair
Результат BExIS.Dlm.Entities.Party.PartyTypePair
        public PartyTypePair UpdatePartyTypePair(PartyTypePair entity)
        {
            Contract.Requires(entity != null && entity.Id > 0);
            Contract.Ensures(Contract.Result<PartyTypePair>() != null && Contract.Result<PartyTypePair>().Id >= 0);
            using (IUnitOfWork uow = this.GetUnitOfWork())
            {
                IRepository<PartyTypePair> repo = uow.GetRepository<PartyTypePair>();
                //Is it usefull?
                //var similarPartTypePair = repo.Get(item => item.Id!=entity.Id && (item.AlowedSource == entity.AlowedSource && item.AlowedTarget == entity.AlowedTarget));
                //if (similarPartTypePair.Any())
                //    throw new Exception("Update party type pair failed.\r\nThere is already an entity with the same elements.");
                repo.Put(entity); // Merge is required here!!!!
                uow.Commit();
            }
            return (entity);
        }