Hello Keith,
We have an old project that depends alot on publishers/subscribers and it always had problems with it. For some reason the project has problems with publishings getting lost etc Since the publishing/subscribing is a crital part of this project we're discussing migrating it to your event system.
The biggest problem I see is that we have over 100 data contracts classes that we serialize, some through remoting others are published. This means alot of diferen events.
From what I've read for the new version 3.0, you say we can use our own serializor. So lets say I have this class bellow
[DataContract]
public class CommuteMessage
{
[DataMember]
public int SourceID { get; set; }
[DataMember]
public string SourceName { get; set; }
[DataMember]
public int SinkID { get; set; }
[DataMember]
public int? ChannelID { get; set; }
[DataMember]
public int MacroID { get; set; }
[DataMember]
public DateTime DateTime { get; set; }
[DataMember]
public int UserID { get; set; }
[DataMember]
public bool IsFromSituation { get; set; }
[DataMember]
public bool IsFromMacro { get; set; }
}
In the new version, if we wanted to send this class as an event we should do one of the following:
-
Make this classe derive from the class Events and implement the GetObjectData and SetElement and then we could use the built-in serialize or ours;
-
Creat a new class as follows:
public class SendCommuteMessage : Event
{
public CommuteMessage Message { get; set; }
public override void GetObjectData(WspBuffer buffer)
{
...
}
public override bool SetElement(string elementName, object elementValue)
{
...
}
}
The second solution seems to be what would work best, because we have alot of classes that have more complex types than int, bool etc. By complex types I mean classes that reference other classes, have generic lists of other classes.
Having said all that, what do you recomend in terms of migrating to this event system?
|