For what it is worth, in my current project, I have patched the
problem with the following customer serializer: My proposed solution
would be to incorporate the functionality logic into RSBs
XmlMessageSerializer.
internal class DateTimeSerializer : ICustomElementSerializer
{
public bool CanSerialize(Type type)
{
return type == typeof(DateTime);
}
public XElement ToElement(object val, Func<Type, XNamespace>
getNamespace)
{
using (var ms = new MemoryStream())
{
ms.Seek(0, SeekOrigin.Begin);
var xml = string.Format("<DateTime Kind=\"{0}\">{1}</
DateTime>",
((DateTime)val).Kind,
((DateTime)val).ToString("yyyy-MM-
ddTHH:mm:ss.fffffff", CultureInfo.InvariantCulture));
var xElement = XElement.Parse(xml);
return xElement;
}
}
public object FromElement(Type type, XElement element)
{
var childElement =
XElement.Parse(element.FirstNode.NextNode.ToString());
var serializationMode =
(XmlDateTimeSerializationMode)Enum.Parse(typeof(XmlDateTimeSerializationMode),
childElement.FirstAttribute.Value);
return XmlConvert.ToDateTime(childElement.Value,
serializationMode);
}
}
--
You received this message because you are subscribed to the Google Groups
"Rhino Tools Dev" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rhino-tools-dev?hl=en.