Exemple #1
0
        /// <summary>
        /// Elimina aggregato (fascicolo) - Elimina anche tutti i riferimenti alle DocumentiUnit aggregate.
        /// </summary>
        /// <param name="idAggregate">Chiave aggregato</param>
        /// <returns>N. di rercord complessivamente eliminati</returns>
        public static int UdsDeleteDocumentUnitAggregate(Guid idAggregate)
        {
            EntityProvider provider = DbProvider;

            using (DbTransaction tran = provider.BeginNoSave())
            {
                try
                {
                    provider.UdsDeleteDocumentUnitAggregateChain(idAggregate);
                    provider.UdsDeleteDocumentUnitAggregate(idAggregate);

                    int count = provider.SaveChanges();
                    tran.Commit();
                    return(count);
                }
                catch
                {
                    try
                    {
                        tran.Rollback();
                    }
                    catch
                    {
                    }
                    throw;
                }
            }
        }