public object ToValue(Type propertyType, XmlString xmlValue) { var nullableType = Nullable.GetUnderlyingType(propertyType); if (nullableType != null) { // is nullable return(xmlValue.Value == null ? null : this.ResolveValue(nullableType, xmlValue)); } else { return(this.ResolveValue(propertyType, xmlValue)); } }
protected object ResolveValue(Type propertyType, XmlString xmlValue) { if (propertyType == typeof(Guid)) { return(new Guid(xmlValue.Value)); } else if (propertyType == typeof(DateTime)) { return(DateTime.Parse(xmlValue.Value)); } else if (this.assemblyInfoService.IsEnum(propertyType)) { return(Enum.Parse(propertyType, xmlValue.Value)); } else { return(xmlValue.Value); } }
public string ToString(XmlString xmlValue) { var value = xmlValue.Value; if (value != null) { if (value == "") { return(this.xmlService.GetRoot(xmlValue.NodeName, null, false)); } else { return(this.xmlService.GetRoot(xmlValue.NodeName, value, false)); } } else { return(this.xmlService.GetNilNode(xmlValue.NodeName)); } }