[xsde-users] Type mapping
Thomas Frenzel (TomSun)
tftomsun at streamteam.de
Mon Dec 7 05:47:06 EST 2009
Hi Boris,
1. Template base classes
i am not sure, but i think it is possible to replace a generated type by a self implemented type, right?. Is it also possible to create a type mapping to a template type? What i would like to do is the following:
I create a schema with an empty base complex type and several derived type.
In the code generation i want to replace the empty base type by an self implemented template type.
So i would need a posibility to define the template parameters foreach derived type.
One use case for this scenario would be:
Each derived complex type implements a Value attribute. But the Value attributes have a different types (e.g. int, float, long, etc.)
My template class implements some operators (e.g. +, -, etc.)
What i could do now is simply calculate with the generated types, without having to implement the operators for each of the generated types.
Is there already a possibility to do that? Do you think this would be useful or would you suggest another way to use schema generated types in a generic way?
2. overriding, abstract definition
Another feature would be nice, too. If i could define a attribute or element as abstract in the base complex type and define an element with the same name but with an default value in the derived type, i could provide something like metadata for my generated types.
For example:
I define an simple type enumeration "MyType" with three values ("TypeA","TypeB","TypeC")
I define a base complex type "MyBase" with an abstract Attribute "Type" of type "MyType"
I define three complex types "MyTypeA","MyTypeB","MyTypeC" that derive from my base complex types
And now i override the "Type" attribute and assign the default or fixed value foreach derived type.
MyTypeA.Type = MyType::TypeA
MyTypeB.Type = MyType::TypeB
MyTypeC.Type = MyType::TypeC
With this solution i could determine without any casting of which type the current instance in a list of "MyBase" is.
Alot of questions... :) Thank you in advance for your answer.
Regards, Tom
More information about the xsde-users
mailing list