コード例 #1
0
 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();
         }
     }
 }
コード例 #2
0
ファイル: Updater.cs プロジェクト: aries544/eXpand
        public override void UpdateDatabaseAfterUpdateSchema() {
            base.UpdateDatabaseAfterUpdateSchema();

            var uniqueName = new ExternalApplicationModelStore().Name;
            var session = ((XPObjectSpace)ObjectSpace).Session;
            if (new QueryModelDifferenceObject(session).GetActiveModelDifference(uniqueName, "ExternalApplication") == null) {
                var modelDifferenceObject = new ModelDifferenceObject(session).InitializeMembers("ExternalApplication", "ExternalApplication.Win", uniqueName);
                modelDifferenceObject.PersistentApplication.ExecutableName = "ExternalApplication.Win.exe";
                var modelApplicationBuilder = new ModelLoader(modelDifferenceObject.PersistentApplication.ExecutableName,XafTypesInfo.Instance);
                InterfaceBuilder.SkipAssemblyCleanup = true;
                var model = modelApplicationBuilder.GetLayer(typeof(ExternalApplicationModelStore), false,info => info.AssignAsInstance());
                InterfaceBuilder.SkipAssemblyCleanup = false;
                modelDifferenceObject.CreateAspects(model);
                ObjectSpace.CommitChanges();
            }
        }
コード例 #3
0
 protected override void OnCurrentObjectChanged() {
     _modelLoader = new ModelLoader(CurrentObject.PersistentApplication.ExecutableName, XafTypesInfo.Instance);
     _masterModel = GetMasterModel(false);
     base.OnCurrentObjectChanged();
 }