private SecurityObjectBuilder GetOrCreateBuilder(ModifiedObjectMetadata modifyObjectMetada)
        {
            SecurityObjectBuilder securityObjectMetaData = securityObjectRepository.GetObjectMetaData(modifyObjectMetada.Object);

            if (securityObjectMetaData == null)
            {
                securityObjectMetaData = new SecurityObjectBuilder();
                securityObjectMetaData.SecurityObject = modifyObjectMetada.Object;
                securityObjectMetaData.RealObject     = securityDbContext.RealDbContext.GetObject(modifyObjectMetada.Object);
                securityObjectRepository.RegisterBuilder(securityObjectMetaData);
            }
            return(securityObjectMetaData);
        }
 private void ApplyModification(IEnumerable <EntityEntry> entitiesEntry, IEnumerable <ModifiedObjectMetadata> modifyObjectsMetada)
 {
     foreach (var entityEntry in entitiesEntry)
     {
         ModifiedObjectMetadata modifyObjectMetada     = modifyObjectsMetada.First(p => p.Object == entityEntry.Entity);
         SecurityObjectBuilder  securityObjectMetaData = securityObjectRepository.GetObjectMetaData(entityEntry.Entity);
         if (securityObjectMetaData == null)
         {
             securityObjectMetaData                = new SecurityObjectBuilder();
             securityObjectMetaData.RealObject     = securityDbContext.RealDbContext.GetObject(entityEntry.Entity);
             securityObjectMetaData.SecurityObject = entityEntry.Entity;
             securityObjectRepository.RegisterBuilder(securityObjectMetaData);
         }
         ApplyModyfication(securityObjectMetaData.RealObject, modifyObjectMetada);
     }
 }
 private void ApplyModyfication(object realObject, ModifiedObjectMetadata modifyObjectMetada)
 {
     ApplyModification(realObject, modifyObjectMetada.Properties);
     ApplyModification(realObject, modifyObjectMetada.ForeignKeys);
 }