Esempio n. 1
0
        protected internal override void OnDifferenceObjectSaving(ModelDifferenceObject userModelDifferenceObject, ModelApplicationBase model)
        {
            var userStoreObject = ((UserModelDifferenceObject)userModelDifferenceObject);

            if (!userStoreObject.NonPersistent)
            {
                userModelDifferenceObject.CreateAspectsCore(model);
                base.OnDifferenceObjectSaving(userModelDifferenceObject, model);
            }
            CombineModelFromPermission(model);
        }
Esempio n. 2
0
 void CombineModelFromPermission(ModelApplicationBase model)
 {
     if (SecuritySystem.Instance is ISecurityComplex && IsGranted())
     {
         var space = Application.CreateObjectSpace();
         ModelDifferenceObject difference = GetDifferenceFromPermission((XPObjectSpace)space);
         var master     = new ModelLoader(difference.PersistentApplication.ExecutableName).GetMasterModel(true);
         var diffsModel = difference.GetModel(master);
         new ModelXmlReader().ReadFromModel(diffsModel, model);
         difference.CreateAspectsCore(diffsModel);
         space.SetModified(difference);
         space.CommitChanges();
     }
 }
 void CombineModelFromPermission(ModelApplicationBase model)
 {
     if (SecuritySystem.Instance is ISecurityComplex && IsGranted())
     {
         var space = Application.CreateObjectSpace(typeof(ModelDifferenceObject));
         ModelDifferenceObject difference = GetDifferenceFromPermission((XPObjectSpace)space);
         if (difference != null)
         {
             InterfaceBuilder.SkipAssemblyCleanup = true;
             var master = new ModelLoader(difference.PersistentApplication.ExecutableName, XafTypesInfo.Instance).GetMasterModel(true, info => info.AssignAsInstance());
             InterfaceBuilder.SkipAssemblyCleanup = false;
             var diffsModel = difference.GetModel(master);
             new ModelXmlReader().ReadFromModel(diffsModel, model);
             difference.CreateAspectsCore(diffsModel);
             space.SetModified(difference);
             space.CommitChanges();
         }
     }
 }