ItKey SemanticLayerSourcesAdd(string mon, SemanticLayerSourcesAddArg tArg)
mon. Moniker for working with data model sources.
tArg. Operation execution parameters.
The SemanticLayerSourcesAdd operation adds a source to data model.
To execute the operation, in the mon field specify moniker of opened data model instance with the !Sources postfix. The moniker can be obtained on executing the OpenSemanticLayer operation. It is required to create a source based on template, specify template key in the tArg.itemKey field. One can also set DBMS connection parameters in the tArg.connectionParams field.
The operation results in the key of the created source.
Below is the example of adding a source to data model. The request contains moniker for working with sources and source connection parameters. The response contains key of the created source.
{
"SemanticLayerSourcesAdd" :
{
"mon" : "ECLILKDCBLBDGOAEDKMFIAIDMENFPGPEHLJFNFCLBKCMGDDH!M!S!PHNEOHMDCBLBDGOAECKLPNOCOILIKDEJEJKJAGADEKNADKACB!Sources",
"tArg" :
{
"connectionParams" :
{
"user" : "User",
"pass" : "Password",
"logonDataExt" :
{
"driver" : "MSSQL2012ODBC",
"server" : "DBServer",
"database" : "Repository"
}
}
}
}
}
{
"SemanticLayerSourcesAddResult" :
{
"k" : "1"
}
}
public static ItKey SemanticLayerSourcesAdd(string moniker)
{
var somClient = new SomPortTypeClient(); // Proxy object for operation execution
// Operation execution parameters
var tAdd = new SemanticLayerSourcesAdd()
{
tArg = new SemanticLayerSourcesAddArg()
{
connectionParams = new ConnectionParams()
{
logonDataExt = new MbLogonDataExt()
{
database = "p7repository",
driver = "MSSQL2012ODBC",
server = "v-nrspo-mssql.dev.fs.fsight.world"
},
user = "sa",
pass = "Qwerty1"
}
},
// Moniker of opened data model instance
mon = moniker + "!Sources"
};
// Add source to data model
var result = somClient.SemanticLayerSourcesAdd(tAdd);
return result;
}
See also: