I have a WCF SOAP webservice which communicates with ip devices, each device gives me a message which includes the types of every variable they are going to use:
<tns1:Device wstop:topic="true">
<tnsavg:Logs wstop:topic="true">
<tt:MessageDescription IsProperty="true">
<tt:Data>
<tt:SimpleItemDescription Name="BaseId" Type="xsd:integer"/>
<tt:SimpleItemDescription Name="BootCount" Type="xsd:integer"/>
<tt:SimpleItemDescription Name="SystemLogId" Type="xsd:integer"/>
<tt:SimpleItemDescription Name="AccessLogId" Type="xsd:integer"/>
I might get about 20 to 30 different items, which use mainly int, boolean, and string types. This is and example of the message i can receive:
<wsnt:Message>
<tt:Message UtcTime="2011-01-01T00:02:14.946Z">
<tt:Source/>
<tt:Data>
<tt:SimpleItem Name="BaseId" Value="3332536653"/>
<tt:SimpleItem Name="BootCount" Value="2525"/>
<tt:SimpleItem Name="SystemLogId" Value="73"/>
<tt:SimpleItem Name="AccessLogId" Value="9"/>
</tt:Data>
</tt:Message>
</wsnt:Message>
The main problem here is that i want to show this messages in a property of my controller but i do not know a way of showing them so that the person who is going to use the controller can use them to get information in an easy way. I had thought of creating a class which shows the items in this way:
public class DataClass
{
public string Name;
public string Value;
public string Type;
}
Other option i thought of was using ExpandoObjects, but that means the user would have to hardcode everysingle option, and there might be 40 different messages per device the controller handles.
Is there a better way of doing this so that the controller user can implement it in a easy way?