BExIS.Dlm.Services.Administration.ResearchPlanManager.Delete C# (CSharp) Метод

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

public Delete ( IEnumerable entities ) : bool
entities IEnumerable
Результат bool
        public bool Delete(IEnumerable<ResearchPlan> entities)
        {
            Contract.Requires(entities != null);
            Contract.Requires(Contract.ForAll(entities, (ResearchPlan e) => e != null));
            Contract.Requires(Contract.ForAll(entities, (ResearchPlan e) => e.Id >= 0));

            using (IUnitOfWork uow = this.GetUnitOfWork())
            {
                IRepository<ResearchPlan> repo = uow.GetRepository<ResearchPlan>();

                foreach (var entity in entities)
                {
                    var latest = repo.Reload(entity);

                    // remove all associations between current unit and the conversions
                    latest.Datasets.ToList().ForEach(a => a.ResearchPlan = null);

                    //delete the entity
                    repo.Delete(latest);
                }
                // commit changes
                uow.Commit();
            }
            return (true);
        }

Same methods

ResearchPlanManager::Delete ( ResearchPlan entity ) : bool