Upload
kenneth-nielsen
View
224
Download
5
Tags:
Embed Size (px)
DESCRIPTION
This session was about Master Data Services and what it also could be used as - the client wanted an application to validate and submit warehouse inventories.
Citation preview
About me
Kenneth M. Nielsen
Managing Consultant at Rehfeld
@doktorkermit
Linkedin.com/in/KennethMNielsen
www.funkylab.com
26-11-2014
Program
MDS – brief history
Scenario
Solutions
MDS as an application
Demo
MDS API
MDS Datamodel
Code Examples
?
26-11-2014
MDS – Brief history
Microsoft acquired Stratature MDM product
titled +EDM in 2007
Shipped with SQL Server 2008 R2
Almost useless, in that state
Major improvements in SQL Server 2012 release
No improvements in MDS for SQL Server 2014
26-11-2014
Scenario
Have to be able to calculate stockvalue after
provision and excess
Have to be able to generate import file to
Navision after calculation
Have to be easy to use, for controllers
MUST use data from Datawarehouse
26-11-2014
Solutions
Develop an application solely for this purpose
Look for standard software from Microsoft,
that we already paid for
Small changes / custom development is allowed
Keep the manual process
26-11-2014
We chose
We chose Master Data Services from Microsoft
Comes out of the box with SQL Server 2008r2/12/14 (Enterprise and BI)
Fairly easy to use
Add-in for Excel
Fairly easy to implement business rules
Custom workflows and Custom Business rulescan be implemented
SQL Server already bought and paid for
26-11-2014
Solution implemented
Data read daily from datawarehouse
Until freezedate is hit, the load stops
At freezedate, data is moved to separate
MDS entities (lists)
When freezeperiod is over data, is loaded
again.
26-11-2014
Solution implemented
26-11-2014
1. Check if Version exists in MDS
1. Yes - Then delete (to empty)
2. No – Then copy from template
2. Truncate MDS staging
3. Move data into MDS staging
4. Load data MDS staging to Model
5. Validate Model
MDS API
Most operations can be started by T-sql or by
stored procedures in SSIS
Open API, not like in Data Quality Service,
where everything is encrypted
Not that much documentation at hand
A few blogposts so far, community is building
Use Profiler to listen and catch T-SQL and
Stored procedure calls from MDS manager
26-11-2014
MDS Automation
Housekeeping packages
Create subscriptionviews
Lock Version
Unlock Version
Copy Version
Import Data to Model
Truncate Model
Disable Business Rules
Enable Business Rules
26-11-2014
MDS Automation
Create Subscriptionviews via SSIS or stored
procedures
Fast
Automation
Meta data driven
26-11-2014
MDS List
The controller can only see and
edit his own data
And only the columns that need
information from him
26-11-2014
Custom Workflow i MDS
Almost no documentation – one article on
technet http://tinyurl.com/nhaknla
Must be installed by hand
No good debugging
Blogpost on the way describing this in details
on www.funkylab.com
26-11-2014
Workflow DLL – C#
Remember to add references to the MDS workflow
Microsoft.MasterDataServices.Workflow;
Microsoft.MasterDataServices.WorkflowTypeExtender;
XmlNode xmlBusinessRule =
dataElement.SelectSingleNode("//ExternalAction/Server_URL");
string BusinessRule = xmlBusinessRule.InnerText;
26-11-2014
Workflow DLL – C#
26-11-2014
using Microsoft.MasterDataServices.Workflow;
using Microsoft.MasterDataServices.WorkflowTypeExtender;
namespace EaOBusinessRule
{
public class GNCustomWorkFlow : IWorkflowTypeExtender
{
public void StartWorkflow(string workflowType, System.Xml.XmlElement dataElement)
{
XmlNode xmlBusinessRule = dataElement.SelectSingleNode("//ExternalAction/Server_URL");
string BusinessRule = xmlBusinessRule.InnerText;
switch (BusinessRule)
{
case "CalculateTotals":
ExecuteBusinessRule_CalculateAfterAdj(workflowType, dataElement);
break;
//case "do something else
//ExecuteBusinessRule_CalculateSomethingElse(workflowType, dataElement);
default:
break;
}
}
Workflow DLL – C#
Attribute names in XML
Blanks will be replaced by _x0020_
dataElement.GetElementsByTagName
("Adjustment_x0020_Obsolete")[0].InnerText;
26-11-2014
Workflow DLL – C#
Look up attributeID’s in MDS datamodel
EntityID is read from MDS XML
dataElement.GetElementsByTagName("Entity_ID")[0].InnerText;
SELECT CAST([ID] AS VARCHAR(100)) AS [ID]
FROM [mdm].[tblAttribute] AS attributes
WHERE attributes.[Entity_ID] = " + EntityID.ToString() + "
AND attributes.[Name] = 'Total Provision'
26-11-2014
Custom Workflow i MDS
Configured by XML
26-11-2014
<applicationSettings>
<Microsoft.MasterDataServices.Workflow.Properties.Settings>
<setting name="ConnectionString" serializeAs="String">
<value>Server=10.200.10.160;Database=MDS;Integrated Security=SSPI</value>
</setting>
<setting name="WorkflowTypeExtenders" serializeAs="String">
<value>MDSWFS=EaOBusinessRule.GNCustomWorkFlow, EaOBusinessRule, ….</value>
</setting>
</Microsoft.MasterDataServices.Workflow.Properties.Settings>
</applicationSettings>
Debugging Custom Workflow
Easiest way to debug is writeing to the
console
Start workflow service in ”console mode” on
the server where MDS is running
Microsoft.MasterDataServices.Workflow.exe
–console
26-11-2014
MDS Workflow Service
Manually install MDS Workflow service
Set up an Service Account
Change it to Automatically startup
26-11-2014