You can model a Windows Communication Foundation (WCF)
data contract.
Before you begin
To use the stereotypes required in this procedure, you must
apply the .Net WCF profile to the model. The C# transformation profile
is optional for creating C# structs.
About this task
To model a WCF data contract in a diagram:
Procedure
- Add a UML class in the diagram.
- Apply the «Data Contract» stereotype to the class. Optionally, to create a C# struct, also apply the «CSharp Struct»
stereotype to the class.
- On the Stereotypes page of the Properties view, under Stereotype
Properties, set the data contract properties
as required for your implementation.
- In the class, add one or more UML attributes.
- To each attribute you want serialized, apply the «Data
Member» stereotype.
- Select a serialized attribute; on the Stereotypes page
of the Properties view, under Stereotype Properties,
set the Data Member properties as required
for your implementation.
Example
The following image shows a sample diagram of a data contract.
The following screen capture shows the stereotype properties
for data contract in the Properties view.
What to do next
After modeling the data contract, you can configure and run
a UML-to-C# transformation to generate the C# code.