Example #1
0
 public virtual Dictionary <Guid, IntegrityCheck> EntityIntegrityCheck()
 {
     using (Mixins.OfType <CorruptMixin>().Any(c => c.Corrupt) ? Corruption.AllowScope() : null)
     {
         return(EntityIntegrityCheckBase());
     }
 }
Example #2
0
        protected internal override void PreSaving(PreSavingContext ctx)
        {
            base.PreSaving(ctx);

            if (Corrupt)
            {
                var integrity = MainEntity.EntityIntegrityCheckBase(); // So, no corruption allowed
                if (integrity == null)
                {
                    this.Corrupt = false;
                    if (!MainEntity.IsNew)
                    {
                        Corruption.OnCorruptionRemoved(MainEntity);
                    }
                }
                else if (MainEntity.IsNew)
                {
                    Corruption.OnSaveCorrupted(MainEntity, integrity);
                }
            }
        }
        protected internal override void PreSaving(ref bool graphModified)
        {
            base.PreSaving(ref graphModified);

            if (Corrupt)
            {
                var integrity = MainEntity.IdentifiableIntegrityCheckBase(); // So, no corruption allowed
                if (integrity == null)
                {
                    this.Corrupt = false;
                    if (!MainEntity.IsNew)
                    {
                        Corruption.OnCorruptionRemoved(MainEntity);
                    }
                }
                else if (MainEntity.IsNew)
                {
                    Corruption.OnSaveCorrupted(MainEntity, integrity);
                }
            }
        }