Welcome Guest! To enable all features please Login or Register.



How to map a logical type to a CLR data type
#1 Posted : Wednesday, August 8, 2012 5:25:31 PM(UTC)

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.
  1. 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"
  2. 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.
  3. Set the name attribute by selecting the CLR type from the list or by entering your own type.
  4. If the CLR type is a value type then set the valuetype attribute to true.
  5. 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.
  6. 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.
<module xmlns="http://www.xomega.net/omodel"
    <type name="my type" base="money">
        <clr:type name="decimal" valuetype="true"/>
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.