Microsoft.AnalysisServices.Tabular.JsonScripter.ScriptCreateOrReplace(Microsoft.AnalysisServices.Core.Database)

Here are the examples of the csharp api class Microsoft.AnalysisServices.Tabular.JsonScripter.ScriptCreateOrReplace(Microsoft.AnalysisServices.Core.Database) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

4 Examples 7

1. Example

Project: Analysis-Services
Source File: TabularModel.cs
public string ScriptDatabase()
        {
            FinalValidation();

            //script db to json
            string json = JsonScripter.ScriptCreateOrReplace(_database);

            if (_connectionInfo.UseProject)
            {
                //replace db/cube name/id with name of deploymnet db from the project file
                JObject jScript = JObject.Parse(json);
                JObject createOrReplace = (JObject)jScript["createOrReplace"];
                if (!String.IsNullOrEmpty(_connectionInfo.DeploymentServerDatabase))
                {
                    ((JObject)createOrReplace["object"])["database"] = _connectionInfo.DeploymentServerDatabase;
                    ((JObject)createOrReplace["database"])["name"] = _connectionInfo.DeploymentServerDatabase;
                    ((JObject)createOrReplace["database"])["id"] = _connectionInfo.DeploymentServerDatabase;
                }
                json = jScript.ToString();
            }

            return json;
        }

2. Example

Project: Analysis-Services
Source File: TabularModel.cs
private void UpdateWithScript()
        {
            //_database.Update(Amo.UpdateOptions.ExpandFull); //If make minor changes to table (e.g. display folder) without changes to the partition or column structure, this command will still lose the data due to TOM applying a full log of operations. So instead reconnect and run TMSL script.

            //includeRestrictedInformation only includes passwords in connections if they were added during this session (does not allow derivation of passwords from the server)
            string tmslCommand = JsonScripter.ScriptCreateOrReplace(_database, includeRestrictedInformation: true);

            _server.Disconnect();
            _server = new Server();
            _server.Connect("Provider=MSOLAP;Data Source=" + _connectionInfo.ServerName);
            Amo.XmlaResultCollection results = _server.Execute(tmslCommand);
            if (results.ContainsErrors)
                throw new Amo.OperationException(results);

            _database = _server.Databases.FindByName(_connectionInfo.DatabaseName);

            //FROM THIS POINT ONWARDS use only TOM as have not bothered re-hydrating the BismNorm object model
        }

3. Example

Project: BismNormalizer
Source File: TabularModel.cs
private void UpdateWithScript()
        {
            //_database.Update(Amo.UpdateOptions.ExpandFull); //If make minor changes to table (e.g. display folder) without changes to the partition or column structure, this command will still lose the data due to TOM applying a full log of operations. So instead reconnect and run TMSL script.

            //includeRestrictedInformation only includes passwords in connections if they were added during this session (does not allow derivation of passwords from the server)
            string tmslCommand = JsonScripter.ScriptCreateOrReplace(_database, includeRestrictedInformation: true);

            _server.Disconnect();
            _server = new Server();
            _server.Connect("Provider=MSOLAP;Data Source=" + _connectionInfo.ServerName);
            Amo.XmlaResultCollection results = _server.Execute(tmslCommand);
            if (results.ContainsErrors)
                throw new Amo.OperationException(results);

            _database = _server.Databases.FindByName(_connectionInfo.DatabaseName);

            //FROM THIS POINT ONWARDS use only TOM as have not bothered re-hydrating the BismNorm object model
        }

4. Example

Project: BismNormalizer
Source File: TabularModel.cs
public string ScriptDatabase()
        {
            FinalValidation();

            //script db to json
            string json = JsonScripter.ScriptCreateOrReplace(_database);

            if (_connectionInfo.UseProject)
            {
                //replace db/cube name/id with name of deploymnet db from the project file
                JObject jScript = JObject.Parse(json);
                JObject createOrReplace = (JObject)jScript["createOrReplace"];
                if (!String.IsNullOrEmpty(_connectionInfo.DeploymentServerDatabase))
                {
                    ((JObject)createOrReplace["object"])["database"] = _connectionInfo.DeploymentServerDatabase;
                    ((JObject)createOrReplace["database"])["name"] = _connectionInfo.DeploymentServerDatabase;
                    ((JObject)createOrReplace["database"])["id"] = _connectionInfo.DeploymentServerDatabase;
                }
                json = jScript.ToString();
            }

            return json;
        }