예제 #1
0
        protected override void Execute(CodeActivityContext context)
        {
            string configurationFile = ConfigurationFile.Get(context);
            string manifestFile      = ModelManifestFile.Get(context);
            string version           = VersionOverride.Get(context);
            string description       = DescriptionOverride.Get(context);
            var    serverConfig      = Helper.GetServerConfig(configurationFile);

            CodeCrib.AX.Manage.ModelStore store = null;
            if (serverConfig.AOSVersionOrigin.Substring(0, 3) == "6.0")
            {
                store = new Manage.ModelStore(serverConfig.DatabaseServer, string.Format("{0}", serverConfig.Database));
            }
            else
            {
                store = new Manage.ModelStore(serverConfig.DatabaseServer, string.Format("{0}_model", serverConfig.Database));
            }

            if (!string.IsNullOrEmpty(version) || !string.IsNullOrEmpty(description))
            {
                store.CreateModel(manifestFile, version, description);
            }
            else
            {
                store.CreateModel(manifestFile);
            }

            if (SetNoInstallMode.Get(context))
            {
                store.SetNoInstallMode();
            }
        }
예제 #2
0
        protected override void Execute(CodeActivityContext context)
        {
            string configurationFile = ConfigurationFile.Get(context);
            string modelName, publisher, layer;

            CodeCrib.AX.Manage.ModelStore.ExtractModelInfo(ModelManifestFile.Get(context), out publisher, out modelName, out layer);
            var serverConfig = Helper.GetServerConfig(configurationFile);

            CodeCrib.AX.Manage.ModelStore store = null;
            if (serverConfig.AOSVersionOrigin.Substring(0, 3) == "6.0")
            {
                store = new Manage.ModelStore(serverConfig.DatabaseServer, string.Format("{0}", serverConfig.Database));
            }
            else
            {
                store = new Manage.ModelStore(serverConfig.DatabaseServer, string.Format("{0}_model", serverConfig.Database));
            }

            context.TrackBuildMessage(string.Format("Uninstalling all models from layer {0}", layer));
            store.UninstallAllLayerModels(layer);
            if (SetNoInstallMode.Get(context))
            {
                store.SetNoInstallMode();
            }
        }
예제 #3
0
        protected override void Execute(CodeActivityContext context)
        {
            string configurationFile  = ConfigurationFile.Get(context);
            string modelStoreFile     = ModelStoreFile.Get(context);
            string axutilFolder       = AxUtilBinaryFolder.Get(context);
            var    serverConfig       = Helper.GetServerConfig(configurationFile);
            bool   compressModelStore = CompressModelStore.Get(context);

            CodeCrib.AX.Manage.ModelStore store = null;
            if (serverConfig.AOSVersionOrigin.Substring(0, 3) == "6.0")
            {
                store = new Manage.ModelStore(serverConfig.DatabaseServer, string.Format("{0}", serverConfig.Database), axutilFolder);
            }
            else
            {
                store = new Manage.ModelStore(serverConfig.DatabaseServer, string.Format("{0}_model", serverConfig.Database), axutilFolder);
            }

            store.ExportModelStore(modelStoreFile);

            if (compressModelStore)
            {
                Helper.CompressFile(new FileInfo(modelStoreFile));
            }
        }
예제 #4
0
        protected override void Execute(CodeActivityContext context)
        {
            string configurationFile = ConfigurationFile.Get(context);
            string modelFile         = ModelFile.Get(context);
            var    serverConfig      = Helper.GetServerConfig(configurationFile);
            bool   overwrite         = OverwriteExisting.Get(context);

            CodeCrib.AX.Manage.ModelStore store = null;
            if (serverConfig.AOSVersionOrigin.Substring(0, 3) == "6.0")
            {
                store = new Manage.ModelStore(serverConfig.DatabaseServer, string.Format("{0}", serverConfig.Database));
            }
            else
            {
                store = new Manage.ModelStore(serverConfig.DatabaseServer, string.Format("{0}_model", serverConfig.Database));
            }

            if (overwrite)
            {
                store.InstallModelOverwrite(modelFile);
            }
            else
            {
                store.InstallModel(modelFile);
            }
            if (SetNoInstallMode.Get(context))
            {
                store.SetNoInstallMode();
            }
        }
예제 #5
0
        /// <summary>
        /// Populates the out parameters according to the provided manifest, configuration file, and layer codes list.  Typically used to launch
        /// a client for a specific layer and/or model.
        /// </summary>
        /// <param name="configurationFile">An AX configuration file, used to resolve server configuration and therefore model store location.</param>
        /// <param name="layerCodes">A list of layer access codes.</param>
        /// <param name="modelManifest">A manifest from which layer, model, and publisher information is retrieved.</param>
        /// <param name="modelName">Returns the model name referenced by the manifest.</param>
        /// <param name="publisher">Returns the publisher name referenced by the manifest.</param>
        /// <param name="layer">Returns the layer ID referenced by the manifest.</param>
        /// <param name="layerCode">Returns the layer code for the layer ID referenced by the manifest.</param>
        public static void ExtractClientLayerModelInfo(string configurationFile, StringList layerCodes, string modelManifest, out string modelName, out string publisher, out string layer, out string layerCode)
        {
            CodeCrib.AX.Manage.ModelStore.ExtractModelInfo(modelManifest, out publisher, out modelName, out layer);

            string layerInternal = layer;

            Config.Server serverConfig = Helper.GetServerConfig(configurationFile);
            CodeCrib.AX.Manage.ModelStore modelStore = null;
            if (serverConfig.AOSVersionOrigin.Substring(0, 3) == "6.0")
            {
                modelStore = new Manage.ModelStore(serverConfig.DatabaseServer, string.Format("{0}", serverConfig.Database));
            }
            else
            {
                modelStore = new Manage.ModelStore(serverConfig.DatabaseServer, string.Format("{0}_model", serverConfig.Database));
            }

            // Validate if model exists unless it's the default layer model
            if (!modelStore.ModelExist(modelName, publisher, layer) && !string.Equals(string.Format("{0} model", layer), modelName, StringComparison.InvariantCultureIgnoreCase))
            {
                throw new Exception(string.Format("Model {0} ({1}) does not exist in layer {2}", modelName, publisher, layer));
            }

            // Supports:
            // var:CODE
            // var : CODE
            // varCODE
            // var CODE
            layerCode = (from c in layerCodes where c.Substring(0, 3).ToLower() == layerInternal.ToLower() select c.Substring(3).Trim()).FirstOrDefault();
            if (!string.IsNullOrEmpty(layerCode) && layerCode[0] == ':')
            {
                layerCode = layerCode.Substring(1).Trim();
            }

            // An empty layer code is only allowed when either not specifying a layer, or when explicitly specifying the USR or USP layer.
            if (string.IsNullOrEmpty(layerCode) && !string.IsNullOrEmpty(layer) && String.Compare(layer, "USR", true) != 0 && String.Compare(layer, "USP", true) != 0)
            {
                throw new Exception(string.Format("Layer '{0}' requires an access code which couldn't be found in the Layer Codes argument", layer));
            }
        }
예제 #6
0
        protected override void Execute(CodeActivityContext context)
        {
            string configurationFile = ConfigurationFile.Get(context);
            string modelFile = ModelFile.Get(context);
            string axutilFolder = AxUtilBinaryFolder.Get(context);
            string modelName, publisher, layer;

            CodeCrib.AX.Manage.ModelStore.ExtractModelInfo(ModelManifestFile.Get(context), out publisher, out modelName, out layer);
            string keyFile      = StrongNameKeyFile.Get(context);
            var    serverConfig = Helper.GetServerConfig(configurationFile);

            CodeCrib.AX.Manage.ModelStore store = null;
            if (serverConfig.AOSVersionOrigin.Substring(0, 3) == "6.0")
            {
                store = new Manage.ModelStore(serverConfig.DatabaseServer, string.Format("{0}", serverConfig.Database), axutilFolder);
            }
            else
            {
                store = new Manage.ModelStore(serverConfig.DatabaseServer, string.Format("{0}_model", serverConfig.Database), axutilFolder);
            }

            context.TrackBuildMessage(string.Format("Exporting model {0} ({1})", modelName, publisher));
            store.ExportModel(modelName, publisher, modelFile, keyFile);
        }