Quantcast
Channel: URF - Unit of Work & (extensible/generic) Repositories Framework
Viewing all articles
Browse latest Browse all 1539

New Post: Delete subitems / children

$
0
0
Is adding the following to the LanguageService delete call a good solution?
   public override void Delete(Language entity)
        {
            IUnitOfWork  unitOfWork= _repository.UnitOfWork();

            try
            {
                unitOfWork.BeginTransaction();

                //ApplicationSettingDetails
                while (entity.ApplicationSettingDetails.Count() > 0)
                {
                    unitOfWork.Repository<ApplicationSettingDetail>().Delete(entity.ApplicationSettingDetails.First());
                }

                base.Delete(entity.LanguageId);

                unitOfWork.Commit();
            }
            catch (Exception ex)
            {
                unitOfWork.Rollback();
                throw ex;
            }
            
        }

Viewing all articles
Browse latest Browse all 1539


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>