1
0
mirror of https://github.com/Microsoft/sql-server-samples.git synced 2025-12-08 14:58:54 +00:00
Files
sql-server-samples/samples/features/master-data-services/master-data/README.md
2017-02-02 13:46:51 -08:00

47 lines
2.7 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Master Data Services Master Data API Sample
This is a C# code sample to show how to use MDS APIs to create, read, update, and delete entity members.
The sample code includes the following scenarios.
1. Create a leaf member using MDS API.
2. Get the leaf member information (the member identifier) by the member code using MDS API.
3. Update the leaf member information (change the name) using MDS API.
4. Create a consolidated member using MDS API.
5. Get the consolidated member information (the member identifier) by the member name using MDS API.
6. Update the entity member relationship (make the leaf member a child node of the consolidated member) using MDS API.
7. Delete the consolidated member using MDS API.
8. Delete the leaf member using MDS API.
Please set the MDS URL (plus /Service/Service.svc) to mdsURL in Program.cs.
string mdsURL = @"http://localhost/MDS/Service/Service.svc";
Program.cs uses Reference.cs (the service reference class file) that was generated by using Visual Studio to access MDS Web service API. You may need to regenerate Reference.cs in the case when MDS Web service API is changed.
To generate Reference.cs using Visual Studio:
You need to expose the WSDL. Exposing the WSDL is only necessary at the time when you want to generate proxy classes using a client development tool such as Visual Studio. After a proxy has been generated, the WSDL does not need to be exposed going forward for client programs to call the API.
To enable an http/https Get on the WSDL:
1. Open the MDS web.config file in a text editor (<Program Files\Microsoft SQL Server\Master Data Services\WebApplication\web.config).
2. Search for the tag serviceMetadata and set httpGetEnabled to true (or httpsGetEnabled if using SSL).
To also enable service exception details for additional debugging (not necessary for standard, trapped errors):
1. Search for the tag serviceDebug and set includeExceptionDetailInFaults to true.
After that you need to add a Service Reference to http://ServerName/MdsSiteName/service/service.svc and set the namespace to the service to "MDSTestService" in the following steps using Visual Studio.
1. Click "Add Service Reference".
2. In Address, enter the URL to the MDS service which will be http://ServerName/MdsSiteName/service/service.svc”.
3. Specify the namespace to the service as "MDSTestService" in the Namespace box.
4. Click the Advanced button to configure advanced settings.
5. Check Always generate message contracts.
6. Set the Collection type drop-down to System.Collections.ObjectModel.Collection.
7. Click OK to return to the Add Service Reference dialog.
8. Click OK.
Reference.cs will be generated in MasterData\Service References\MDSTestService folder. You can replace MasterData\Reference.cs with the newly generated one.