Beispiel #1
0
        public static void DeploySPMetaModel(this ClientContext Ctx, WebModelNode model, bool Incremental)
        {
            BeforeDeployModel(Incremental, x =>
            {
                PropertyBagValue incrementalProvisionModelIdProperty = model.PropertyBag.FirstOrDefault(currentPropertyValue =>
                                                                                                        currentPropertyValue.Name == "_sys.IncrementalProvision.PersistenceStorageModelId");
                if (Incremental && incrementalProvisionModelIdProperty == null)
                {
                    new SystemException("Please set incremental provision model id");
                }

                Console.WriteLine("Provisioning preparing model");
                var preparingModel = model.GetContainersModel();
                if (incrementalProvisionModelIdProperty != null)
                {
                    preparingModel.SetIncrementalProvisionModelId("Preparing: " + incrementalProvisionModelIdProperty.Value);
                }
                x.DeployModel(SPMeta2.CSOM.ModelHosts.WebModelHost.FromClientContext(Ctx), preparingModel);
                Console.WriteLine();

                Console.WriteLine("Provisioning main model");
                x.DeployModel(SPMeta2.CSOM.ModelHosts.WebModelHost.FromClientContext(Ctx), model);
            });
        }