Normally if you extend your logical type from another base type in the model, it will automatically inherit the mapping to the CLR type from its parent. If your type does not extend any other logical type, or you just want to override the mapping to the CLR type, then the following steps outline this process.
- Make sure that the module element that contains your logical type declares a prefix for the "http://www.xomega.net/clr" namespace, e.g. xmlns:clr="http://www.xomega.net/clr"
- Add a clr:type element inside of the config element of your logical type definition. In the absence of such element your logical type will just inherit the CLR type from its base type if one exists.
- Set the name attribute by selecting the CLR type from the list or by entering your own type.
- If the CLR type is a value type then set the valuetype attribute to true.
- If the CLR type uses a custom namespace type then set the namespace attribute accordingly. Also if the name of the CLR type may conflict with other classes in the generated code then set the qualify attribute to true to always use a fully qualified CLR type name.
- To validate your setup find a parameter that uses your logical type and then generate WCF service contracts and check the type of the corresponding data member.
Here is a sample configuration that illustrates these steps.
Code:
<module xmlns="http://www.xomega.net/omodel"
xmlns:clr="http://www.xomega.net/clr">
<types>
<type name="my type" base="money">
<config>
<clr:type name="decimal" valuetype="true"/>
</config>
</type>
</types>
</module>