New Samples on MSDN Code Gallery

New Samples on MSDN Code Gallery

  • Comments 1

(This post was contributed by John Burrows, Lead Program Manager for the MDS Team)

A couple of new samples have been posted to the MSDN Code Gallery; two sample models that illustrate recursive and explicit cap hierarchies and a Visual Studio solution that contains an example of calling the Model Deployment API via code.

Sample Models

Employees

The Employee sample model contains the employees of a fictitious Winery “Coho Winery” that has a legal structure in the form of three subsidiaries and an operating structure in the form of four operating groups.

You can download the model from MSDN Code Gallery here:

http://code.msdn.microsoft.com/SSMDSEmployeeSample

Once you unzip the .pkg file you can deploy it to your MDS system using the Model Deployment Wizard. For more information about using the Model Deployment Wizard, see “Deploying Models (Master Data Services)” (http://msdn.microsoft.com/en-us/library/ff486956(SQL.105).aspx) in SQL Server Books Online.

Recursive derived hierarchies are illustrated in the model in three hierarchies:

1. “Reports to” hierarchy. This hierarchy is a simple recursive hierarchy built on the Employee entity and Manager domain-based attribute.

2. “Operating groups” hierarchy. This hierarchy is also a recursive hierarchy that adds the Group domain-based attribute on top of the recursive Employee-Manager relationship.

3. “Subsidiaries” hierarchy. Again, here is another recursive hierarchy that adds the Subsidiary domain-based attribute on top of the Group domain-based attribute on top of the recursive Employee-Manager relationship.

For more information about recursive hierarchies, see “Recursive Hierarchies (Master Data Services)” (http://msdn.microsoft.com/en-us/library/ff487006(SQL.105).aspx) in SQL Server Books Online.

Accounts

The Accounts sample model contains the employees of a fictitious multi-national company, Contoso Pharmaceuticals, which has general ledger systems located in various locations across the globe.

You can download the model from MSDN Code Gallery here:

http://code.msdn.microsoft.com/SSMDSAccountSample

Once you unzip the .pkg file you can deploy it to your MDS system using the Model Deployment Wizard.

The local general ledger systems in the company have different charts of accounts. The “Corporate” hierarchy in the sample illustrates how a derived hierarchy with an explicit cap can be used to establish a standard corporate chart of accounts that combines the local differing chart of accounts. The hierarchy uses the derived relationship between the account and subsidiary account entities and the explicit hierarchy “base” to standardize the rollup of the corporate chart of accounts.

For more information about derived hierarchies with explicit caps, see “Derived Hierarchies with Explicit Caps (Master Data Services)” (http://msdn.microsoft.com/en-us/library/ff486988(SQL.105).aspx) in SQL Server Books Online

Model Deployment API code sample

Deploying the sample

This sample illustrates calling the Model Deployment API via code with a simple console application demonstrating a couple of common methods. You can download the sample here:

http://code.msdn.microsoft.com/ModelDApiSample

Once you download the sample and unzip it, you will need to perform a couple of steps to successfully build the Visual Studio project. These steps are also documented in the readme in the .zip file.

The sample has the following external dependencies:

· Microsoft.MasterDataServices.Core.dll

· Microsoft.MasterDataServices.Deployment.dll

· Microsoft.MasterDataServices.Services.dll

In order to build the solution, you will need to adjust the project references to point to these binaries in your Master Data Services deployment.

You will also need to update the ConnectionString in ModelDUtil.config to point to your deployed database. Please be sure not to change the name of the connection -- that should be left as "defaultMdsConnection". Also, ModelDUtil.config must be located in the same folder as ModelDUtil.exe.

Running the sample

The console application can be run with the following commands:

ModelDUtil [mode] [params]

where [mode] is one of the following:

ListModels -- returns a list of all the user models in the target system

ModelDUtil ListModels

ListVersions -- returns a list of the versions for a given model

ModelDUtil ListVersions [model name]

CreatePackage -- create a package file for a given model

ModelDUtil CreatePackage [output package file name] [model name] [version name]

DeployClone -- deploys a clone of a model from a given package

ModelDUtil DeployClone [input package file name]

DeployNew -- deploys a model from a given package with the new given name

ModelDUtil DeployNew [input package file name] [new model name]

DeployUpdate -- deploys an update to a given version of a model from a given package

ModelDUtil DeployUpdate [input package file name] [version name to update]

DeleteModel -- deletes a given model

ModelDUtil DeleteModel [model name]

Help -- displays the help

ModelDUtil Help

Note: names that contain spaces should be wrapped with double quotation marks. For Example: ModelDUtil DeployUpdate mypackage.pkg "Version 1"

For more information about the API, see the Model Deployment API reference (http://msdn.microsoft.com/en-us/library/microsoft.masterdataservices.deployment(SQL.105).aspx) in SQL Server Books Online.

Leave a Comment
  • Please add 6 and 5 and type the answer here:
  • Post
  • The package needs to be updated for SQL 2012. Thanks!

    When I try to deploy the package using SQL 2012 MDS Manager, I get the following error:

    The package cannot be loaded. The package file is corrupt or the package was created by using an earlier version of Master Data Services.

    Error in line 1 position 238. 'Element' 'masterData' from namespace 'schemas.datacontract.org/.../Microsoft.MasterDataServices.Deployment& is not expected. Expecting element 'exportViews'.

Page 1 of 1 (1 items)