Dynamic Mapping demo
SCHEMA'S
Mapping
Transformation logic inside expression shape:
MapType = System.Type.GetType("DynamicMappingDemo.CanonicalToCustomerA,DynamicMappingDemo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1e189bdf5b6a5b37");
construct customerA
{
transform (customerA) = MapType(generic);
}
//log meesgae
xmlDoc=customerA;
System.Diagnostics.EventLog.WriteEntry("DynamicTransformDemo","customerA:"+xmlDoc.OuterXml);
MapType = System.Type.GetType("DynamicMappingDemo.CanonicalToCustomerB,DynamicMappingDemo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1e189bdf5b6a5b37");
construct CustomerB
{
transform (CustomerB) = MapType(generic);
}
//log meesgae
xmlDoc=CustomerB;
System.Diagnostics.EventLog.WriteEntry("DynamicTransformDemo","customerB:"+xmlDoc.OuterXml);
solution files
sample inputs:
<ns0:Canonical xmlns:ns0="http://DynamicMappingDemo.Canonical">
<Customer>
<id>A</id>
<name>name_A</name>
</Customer>
</ns0:Canonical>
<ns0:Canonical xmlns:ns0="http://DynamicMappingDemo.Canonical">
<Customer>
<id>B</id>
<name>name_B</name>
</Customer>
</ns0:Canonical>
sample out put that will be logged inside event viewer
customerA:<ns0:CustomerA xmlns:ns0="http://DynamicMappingDemo.CustomerA"><ID>A</ID><NAME>name_A</NAME></ns0:CustomerA>
customerB:<ns0:CustomerB xmlns:ns0="http://DynamicMappingDemo.CustomerB"><ID>B</ID><NAME>name_B</NAME></ns0:CustomerB>