Exemplo n.º 1
0
        private static bool ValueObjectsEqual(XmlValueObject left, XmlValueObject right)
        {
            if (ReferenceEquals(left, null) && ReferenceEquals(right, null))
            {
                return(true);
            }
            if (ReferenceEquals(left, null) || ReferenceEquals(right, null))
            {
                return(false);
            }

            return(left.Code.AsString() == right.Code.AsString());
        }
Exemplo n.º 2
0
        private static bool ValueObjectEqualsString(XmlValueObject left, string right)
        {
            if (ReferenceEquals(left, null) && string.IsNullOrEmpty(right))
            {
                return(true);
            }
            if (ReferenceEquals(left, null) || string.IsNullOrEmpty(right))
            {
                return(false);
            }

            return(left.Code.AsString() == right.AsString());
        }
Exemplo n.º 3
0
        private static void SetValue(XmlValueObject target, PropertyInfo info, string value)
        {
            if (info.PropertyType == BooleanType ||
                info.PropertyType == NullableBooleanType)
            {
                info.SetValue(target, value.AsBool().GetValueOrDefault(), null);
            }
            else if (info.PropertyType == IntType ||
                     info.PropertyType == NullableIntType)
            {
                info.SetValue(target, value.AsInt(), null);
            }
            else if (info.PropertyType == DecimalType ||
                     info.PropertyType == NullableDecimalType)
            {
                info.SetValue(target, value.AsDecimal(), null);
            }
            else if (info.PropertyType == TypeType)
            {
                info.SetValue(target, Type.GetType(value), null);
            }
            else if (info.PropertyType == ValueObjectCultureType)
            {
                var serializer = new XmlSerializer(typeof(XmlValueObjectCulture));

                using (StringReader reader = new StringReader(value))
                {
                    XmlValueObjectCulture resultingMessage = (XmlValueObjectCulture)serializer.Deserialize(reader);
                    target.XmlValueObjectCultureInfo.Add(resultingMessage);
                }
            }
            else
            {
                info.SetValue(target, value, null);
            }
        }
Exemplo n.º 4
0
 protected virtual XmlValueObject OnClone(XmlValueObject valueObject)
 {
     return(valueObject);
 }