Commits

Bertrand Le Roy  committed 968e747

WARNING: this changeset and ulterior ones will only compile with Orchard branch theshift and branches where theshift has been merged. Do not update to these changes if you are not ready to upgrade Orchard to those branches.
InfosetHelper, ReflectionHelper, XmlHelper are now in core. Removing from Nwazet.Commerce

  • Participants
  • Parent commits 218dc32

Comments (0)

Files changed (31)

File Controllers/UspsAdminController.cs

 using System.Net;
 using System.Web.Mvc;
 using System.Xml.Linq;
-using Nwazet.Commerce.Helpers;
 using Nwazet.Commerce.Models;
 using Nwazet.Commerce.Services;
+using Orchard.ContentManagement;
 using Orchard.Environment.Extensions;
 using Orchard.UI.Admin;
 

File Drivers/DiscountPartDriver.cs

 using System;
 using System.Globalization;
 using System.Linq;
-using Nwazet.Commerce.Helpers;
 using Nwazet.Commerce.Models;
 using Nwazet.Commerce.ViewModels;
 using Orchard;

File Drivers/OrderPartDriver.cs

 using System.Collections.Generic;
 using System.Linq;
 using System.Xml.Linq;
-using Nwazet.Commerce.Helpers;
 using Nwazet.Commerce.Models;
 using Nwazet.Commerce.Permissions;
 using Nwazet.Commerce.Services;

File Drivers/ProductPartDriver.cs

 using System.Collections.Generic;
 using System.Globalization;
 using System.Linq;
-using Nwazet.Commerce.Helpers;
 using Nwazet.Commerce.Models;
 using Nwazet.Commerce.Services;
 using Orchard;

File Drivers/SizeBasedShippingMethodPartDriver.cs

 using System.Collections.Generic;
 using System.Globalization;
 using System.Linq;
-using Nwazet.Commerce.Helpers;
 using Nwazet.Commerce.Models;
 using Nwazet.Commerce.Services;
 using Orchard.ContentManagement;

File Drivers/StateOrCountryTaxPartDriver.cs

-using Nwazet.Commerce.Helpers;
-using Nwazet.Commerce.Models;
+using Nwazet.Commerce.Models;
 using Orchard.ContentManagement;
 using Orchard.ContentManagement.Drivers;
 using Orchard.ContentManagement.Handlers;

File Drivers/StripeSettingsPartDriver.cs

-using System;
-using Nwazet.Commerce.Helpers;
-using Nwazet.Commerce.Models;
+using Nwazet.Commerce.Models;
 using Orchard.Caching;
 using Orchard.ContentManagement;
 using Orchard.ContentManagement.Drivers;

File Drivers/UspsSettingsPartDriver.cs

-using Nwazet.Commerce.Helpers;
-using Nwazet.Commerce.Models;
+using Nwazet.Commerce.Models;
 using Orchard.ContentManagement;
 using Orchard.ContentManagement.Drivers;
 using Orchard.ContentManagement.Handlers;

File Drivers/UspsShippingMethodPartDriver.cs

 using System.Linq;
-using Nwazet.Commerce.Helpers;
 using Nwazet.Commerce.Models;
 using Nwazet.Commerce.Services;
 using Orchard.ContentManagement;

File Drivers/WeightBasedShippingMethodPartDriver.cs

 using System.Collections.Generic;
 using System.Globalization;
 using System.Linq;
-using Nwazet.Commerce.Helpers;
 using Nwazet.Commerce.Models;
 using Nwazet.Commerce.Services;
 using Orchard.ContentManagement;

File Helpers/InfosetHelper.cs

-using System;
-using System.Linq.Expressions;
-using System.Xml.Linq;
-using Orchard.ContentManagement;
-using Orchard.ContentManagement.FieldStorage.InfosetStorage;
-
-namespace Nwazet.Commerce.Helpers {
-    public static class InfosetHelper {
-        public static TProperty Retrieve<TProperty>(this ContentPart contentPart, string name) {
-            var infosetPart = contentPart.As<InfosetPart>();
-            var el = infosetPart == null
-                ? null
-                : infosetPart.Infoset.Element.Element(contentPart.GetType().Name);
-            return el == null ? default(TProperty) : el.Attr<TProperty>(name);
-        }
-
-        public static void Store<TProperty>(this ContentPart contentPart,
-            string name, TProperty value) {
-
-            var partName = contentPart.GetType().Name;
-
-            var infosetPart = contentPart.As<InfosetPart>();
-            var infoset = infosetPart.Infoset;
-            var partElement = infoset.Element.Element(partName);
-            if (partElement == null) {
-                partElement = new XElement(partName);
-                infoset.Element.Add(partElement);
-            }
-            partElement.Attr(name, value);
-        }
-
-        public static TProperty Retrieve<TPart, TRecord, TProperty>(this TPart contentPart,
-            Expression<Func<TRecord, TProperty>> targetExpression)
-            where TPart : ContentPart<TRecord> {
-
-            var getter = ReflectionHelper<TRecord>.GetGetter(targetExpression);
-            return contentPart.Retrieve(targetExpression, getter);
-        }
-
-        public static TProperty Retrieve<TPart, TRecord, TProperty>(this TPart contentPart,
-            Expression<Func<TRecord, TProperty>> targetExpression,
-            Delegate defaultExpression)
-            where TPart : ContentPart<TRecord> {
-
-            var propertyInfo = ReflectionHelper<TRecord>.GetPropertyInfo(targetExpression);
-            var name = propertyInfo.Name;
-
-            var infosetPart = contentPart.As<InfosetPart>();
-            var el = infosetPart == null
-                ? null
-                : infosetPart.Infoset.Element.Element(contentPart.GetType().Name);
-            if (el == null || el.Attribute(name) == null) {
-                // Property has never been stored. Get it from the default expression and store that.
-                var defaultValue = defaultExpression == null
-                    ? default(TProperty)
-                    : (TProperty)defaultExpression.DynamicInvoke(contentPart.Record);
-                contentPart.Store(name, defaultValue);
-                return defaultValue;
-            }
-            return el.Attr<TProperty>(name);
-        }
-
-        public static void Store<TPart, TRecord, TProperty>(this TPart contentPart,
-            Expression<Func<TRecord, TProperty>> targetExpression,
-            TProperty value)
-            where TPart : ContentPart<TRecord> {
-            
-            var propertyInfo = ReflectionHelper<TRecord>.GetPropertyInfo(targetExpression);
-            var name = propertyInfo.Name;
-            propertyInfo.SetValue(contentPart.Record, value);
-            contentPart.Store(name, value);
-        }
-    }
-}

File Helpers/ReflectionHelper.cs

-using System;
-using System.Collections.Concurrent;
-using System.Linq.Expressions;
-using System.Reflection;
-
-namespace Nwazet.Commerce.Helpers {
-    public class ReflectionHelper<T> {
-        private static readonly ConcurrentDictionary<string, Delegate> _getterCache =
-            new ConcurrentDictionary<string, Delegate>();
-
-        public delegate TProperty PropertyGetterDelegate<out TProperty>(T target);
-
-        /// <summary>
-        /// Gets property info out of a Lambda.
-        /// </summary>
-        /// <typeparam name="TProperty">The return type of the Lambda.</typeparam>
-        /// <param name="expression">The Lambda expression.</param>
-        /// <returns>The property info.</returns>
-        public static PropertyInfo GetPropertyInfo<TProperty>(Expression<Func<T, TProperty>> expression) {
-            var memberExpression = expression.Body as MemberExpression;
-            if (memberExpression == null) {
-                throw new InvalidOperationException("Expression is not a member expression.");
-            }
-            var propertyInfo = memberExpression.Member as PropertyInfo;
-            if (propertyInfo == null) {
-                throw new InvalidOperationException("Expression is not for a property.");
-            }
-            return propertyInfo;
-        }
-
-        /// <summary>
-        /// Gets a delegate from a property expression.
-        /// </summary>
-        /// <typeparam name="TProperty">The type of the property.</typeparam>
-        /// <param name="targetExpression">The property expression.</param>
-        /// <returns>The delegate.</returns>
-        public static PropertyGetterDelegate<TProperty> GetGetter<TProperty>(
-            Expression<Func<T, TProperty>> targetExpression) {
-
-            var propertyInfo = GetPropertyInfo(targetExpression);
-            return (PropertyGetterDelegate<TProperty>) _getterCache
-                .GetOrAdd(propertyInfo.Name,
-                    s => propertyInfo.GetGetMethod()
-                        .CreateDelegate(typeof (PropertyGetterDelegate<TProperty>)));
-        }
-    }
-}

File Helpers/XmlHelper.cs

-using System;
-using System.Globalization;
-using System.Linq;
-using System.Linq.Expressions;
-using System.Xml;
-using System.Xml.Linq;
-
-namespace Nwazet.Commerce.Helpers {
-    public static class XmlHelper {
-        /// <summary>
-        /// Like Add, but chainable.
-        /// </summary>
-        /// <param name="el">The parent element.</param>
-        /// <param name="children">The elements to add.</param>
-        /// <returns>Itself</returns>
-        public static XElement AddEl(this XElement el, params XElement[] children) {
-            el.Add(children.Cast<object>());
-            return el;
-        }
-
-        /// <summary>
-        /// Gets the string value of an attribute, and null if the attribute doesn't exist.
-        /// </summary>
-        /// <param name="el">The element.</param>
-        /// <param name="name">The name of the attribute.</param>
-        /// <returns>The string value of the attribute if it exists, null otherwise.</returns>
-        public static string Attr(this XElement el, string name) {
-            var attr = el.Attribute(name);
-            return attr == null ? null : attr.Value;
-        }
-
-        /// <summary>
-        /// Gets a typed value from an attribute.
-        /// </summary>
-        /// <typeparam name="T">The type of the value</typeparam>
-        /// <param name="el">The element.</param>
-        /// <param name="name">The name of the attribute.</param>
-        /// <returns>The attribute value</returns>
-        public static T Attr<T>(this XElement el, string name) {
-
-            var attr = el.Attribute(name);
-            return attr == null ? default(T) : Parse<T>(attr.Value);
-        }
-
-        /// <summary>
-        /// Sets an attribute value. This is chainable.
-        /// </summary>
-        /// <typeparam name="T">The type of the value.</typeparam>
-        /// <param name="el">The element.</param>
-        /// <param name="name">The attribute name.</param>
-        /// <param name="value">The value to set.</param>
-        /// <returns>Itself</returns>
-        public static XElement Attr<T>(this XElement el, string name, T value) {
-            el.SetAttributeValue(name, ToString(value));
-            return el;
-        }
-
-        /// <summary>
-        /// Returns the text contents of a child element.
-        /// </summary>
-        /// <param name="el">The parent element.</param>
-        /// <param name="name">The name of the child element.</param>
-        /// <returns>The text for the child element, and null if it doesn't exist.</returns>
-        public static string El(this XElement el, string name) {
-            var childElement = el.Element(name);
-            return childElement == null ? null : childElement.Value;
-        }
-
-        /// <summary>
-        /// Creates and sets the value of a child element. This is chainable.
-        /// </summary>
-        /// <typeparam name="T">The type of the value.</typeparam>
-        /// <param name="el">The parent element.</param>
-        /// <param name="name">The name of the child element.</param>
-        /// <param name="value">The value to set.</param>
-        /// <returns>Itself</returns>
-        public static XElement El<T>(this XElement el, string name, T value) {
-            el.SetElementValue(name, value);
-            return el;
-        }
-
-        /// <summary>
-        /// Sets a property value from an attribute of the same name.
-        /// </summary>
-        /// <typeparam name="TTarget">The type of the target object.</typeparam>
-        /// <typeparam name="TProperty">The type of the target property</typeparam>
-        /// <param name="el">The element.</param>
-        /// <param name="target">The target object.</param>
-        /// <param name="targetExpression">The property expression.</param>
-        /// <returns>Itself</returns>
-        public static XElement FromAttr<TTarget, TProperty>(this XElement el, TTarget target,
-            Expression<Func<TTarget, TProperty>> targetExpression) {
-
-            if (target == null) return el;
-            var propertyInfo = ReflectionHelper<TTarget>.GetPropertyInfo(targetExpression);
-            var name = propertyInfo.Name;
-            var attr = el.Attribute(name);
-
-            if (attr == null) return el;
-            propertyInfo.SetValue(target, el.Attr<TProperty>(name), null);
-            return el;
-        }
-
-        /// <summary>
-        /// Sets an attribute with the value of a property of the same name.
-        /// </summary>
-        /// <typeparam name="TTarget">The type of the object.</typeparam>
-        /// <typeparam name="TProperty">The type of the property.</typeparam>
-        /// <param name="el">The element.</param>
-        /// <param name="target">The object.</param>
-        /// <param name="targetExpression">The property expression.</param>
-        /// <returns>Itself</returns>
-        public static XElement ToAttr<TTarget, TProperty>(this XElement el, TTarget target,
-            Expression<Func<TTarget, TProperty>> targetExpression) {
-
-            if (target == null) return el;
-            var propertyInfo = ReflectionHelper<TTarget>.GetPropertyInfo(targetExpression);
-            var name = propertyInfo.Name;
-            var val = (TProperty) propertyInfo.GetValue(target, null);
-
-            el.Attr(name, ToString(val));
-            return el;
-        }
-
-        /// <summary>
-        /// Gets the text value of an element as the specified type.
-        /// </summary>
-        /// <typeparam name="TValue">The type to parse the element as.</typeparam>
-        /// <param name="el">The element.</param>
-        /// <returns>The value of the element as type TValue.</returns>
-        public static TValue Val<TValue>(this XElement el) {
-            return Parse<TValue>(el.Value);
-        }
-
-        /// <summary>
-        /// Sets the value of an element.
-        /// </summary>
-        /// <typeparam name="TValue">The type of the value to set.</typeparam>
-        /// <param name="el">The element.</param>
-        /// <param name="value">The value.</param>
-        /// <returns>The element.</returns>
-        public static XElement Val<TValue>(this XElement el, TValue value) {
-            el.SetValue(ToString(value));
-            return el;
-        }
-
-        /// <summary>
-        /// Serializes the provided value as a string.
-        /// </summary>
-        /// <typeparam name="T">The type of the value.</typeparam>
-        /// <param name="value">The value.</param>
-        /// <returns>The string representation of the value.</returns>
-        public static string ToString<T>(T value) {
-            var type = typeof (T);
-            if (type == typeof (string)) {
-                return Convert.ToString(value);
-            }
-            if ((!type.IsValueType || Nullable.GetUnderlyingType(type) != null) &&
-                value == null &&
-                type != typeof (string)) {
-
-                return "null";
-            }
-
-            if (type == typeof (DateTime) || type == typeof (DateTime?)) {
-                return XmlConvert.ToString(Convert.ToDateTime(value),
-                    XmlDateTimeSerializationMode.Utc);
-            }
-
-            if (type == typeof (bool) ||
-                type == typeof (bool?)) {
-                return Convert.ToBoolean(value) ? "true" : "false";
-            }
-
-            if (type == typeof (int) ||
-                type == typeof (int?)) {
-
-                return Convert.ToInt64(value).ToString(CultureInfo.InvariantCulture);
-            }
-
-            if (type == typeof (double) ||
-                type == typeof (double?)) {
-
-                var doubleValue = (double) (object) value;
-                if (double.IsPositiveInfinity(doubleValue)) {
-                    return "infinity";
-                }
-                if (double.IsNegativeInfinity(doubleValue)) {
-                    return "-infinity";
-                }
-                return doubleValue.ToString(CultureInfo.InvariantCulture);
-            }
-
-            if (type == typeof (float) ||
-                type == typeof (float?)) {
-
-                var floatValue = (float) (object) value;
-                if (float.IsPositiveInfinity(floatValue)) {
-                    return "infinity";
-                }
-                if (float.IsNegativeInfinity(floatValue)) {
-                    return "-infinity";
-                }
-                return floatValue.ToString(CultureInfo.InvariantCulture);
-            }
-
-            if (type == typeof (decimal) ||
-                type == typeof (decimal?)) {
-
-                var decimalValue = Convert.ToDecimal(value);
-                return decimalValue.ToString(CultureInfo.InvariantCulture);
-            }
-
-            throw new NotSupportedException(String.Format("Could not handle type {0}", type.Name));
-        }
-
-        /// <summary>
-        /// Parses a string value as the provided type.
-        /// </summary>
-        /// <typeparam name="T">The destination type</typeparam>
-        /// <param name="value">The string representation of the value to parse.</param>
-        /// <returns>The parsed value with type T.</returns>
-        public static T Parse<T>(string value) {
-            var type = typeof (T);
-
-            if (type == typeof (string)) {
-                return (T) (object) value;
-            }
-            if (value == null ||
-                "null".Equals(value, StringComparison.Ordinal) &&
-                ((!type.IsValueType || Nullable.GetUnderlyingType(type) != null))) {
-
-                return default(T);
-            }
-
-            if ("infinity".Equals(value, StringComparison.Ordinal)) {
-                if (type == typeof (float) || type == typeof (float?)) return (T) (object) float.PositiveInfinity;
-                if (type == typeof (double) || type == typeof (double?)) return (T) (object) double.PositiveInfinity;
-                throw new NotSupportedException(String.Format("Infinity not supported for type {0}", type.Name));
-            }
-            if ("-infinity".Equals(value, StringComparison.Ordinal)) {
-                if (type == typeof (float)) return (T) (object) float.NegativeInfinity;
-                if (type == typeof (double)) return (T) (object) double.NegativeInfinity;
-                throw new NotSupportedException(String.Format("Infinity not supported for type {0}", type.Name));
-            }
-            if (type == typeof (int) || type == typeof (int?)) {
-                return (T) (object) int.Parse(value, CultureInfo.InvariantCulture);
-            }
-            if (type == typeof (bool) || type == typeof (bool?)) {
-                return (T) (object) value.Equals("true", StringComparison.Ordinal);
-            }
-            if (type == typeof (DateTime) || type == typeof (DateTime?)) {
-                return (T) (object) XmlConvert.ToDateTime(value, XmlDateTimeSerializationMode.Utc);
-            }
-            if (type == typeof (double) || type == typeof (double?)) {
-                return (T) (object) double.Parse(value, CultureInfo.InvariantCulture);
-            }
-            if (type == typeof (float) || type == typeof (float?)) {
-                return (T) (object) float.Parse(value, CultureInfo.InvariantCulture);
-            }
-            if (type == typeof (decimal) || type == typeof (decimal?)) {
-                return (T) (object) decimal.Parse(value, CultureInfo.InvariantCulture);
-            }
-            throw new NotSupportedException(String.Format("Could not handle type {0}", type.Name));
-        }
-
-        /// <summary>
-        /// Gives context to an XElement, enabling chained property operations.
-        /// </summary>
-        /// <typeparam name="TContext">The type of the context.</typeparam>
-        /// <param name="el">The element.</param>
-        /// <param name="context">The context.</param>
-        /// <returns>The element with context.</returns>
-        public static XElementWithContext<TContext> With<TContext>(this XElement el, TContext context) {
-            return new XElementWithContext<TContext>(el, context);
-        }
-
-        /// <summary>
-        /// A wrapper for XElement, with context, for strongly-typed manipulation
-        /// of an XElement.
-        /// </summary>
-        /// <typeparam name="TContext">The type of the context.</typeparam>
-        public class XElementWithContext<TContext> {
-            public XElementWithContext(XElement element, TContext context) {
-                Element = element;
-                Context = context;
-            }
-
-            public XElement Element { get; private set; }
-            public TContext Context { get; private set; }
-
-            public static implicit operator XElement(XElementWithContext<TContext> elementWithContext) {
-                return elementWithContext.Element;
-            }
-
-            /// <summary>
-            /// Replaces the current context with a new one, enabling chained action on different objects.
-            /// </summary>
-            /// <typeparam name="TNewContext">The type of the new context.</typeparam>
-            /// <param name="context">The new context.</param>
-            /// <returns>A new XElementWithContext, that has the new context.</returns>
-            public XElementWithContext<TNewContext> With<TNewContext>(TNewContext context) {
-                return new XElementWithContext<TNewContext>(Element, context);
-            }
-
-            /// <summary>
-            /// Sets the value of a context property as an attribute of the same name on the element.
-            /// </summary>
-            /// <typeparam name="TProperty">The type of the property.</typeparam>
-            /// <param name="targetExpression">The property expression.</param>
-            /// <returns>Itself</returns>
-            public XElementWithContext<TContext> ToAttr<TProperty>(
-                Expression<Func<TContext, TProperty>> targetExpression) {
-                Element.ToAttr(Context, targetExpression);
-                return this;
-            }
-
-            /// <summary>
-            /// Gets an attribute on the element and sets the property of the same name on the context with its value.
-            /// </summary>
-            /// <typeparam name="TProperty">The type of the property.</typeparam>
-            /// <param name="targetExpression">The property expression.</param>
-            /// <returns>Itself</returns>
-            public XElementWithContext<TContext> FromAttr<TProperty>(
-                Expression<Func<TContext, TProperty>> targetExpression) {
-                Element.FromAttr(Context, targetExpression);
-                return this;
-            }
-
-            /// <summary>
-            /// Evaluates an attribute from an expression.
-            /// It's a nice strongly-typed way to read attributes.
-            /// </summary>
-            /// <typeparam name="TProperty">The type of the property.</typeparam>
-            /// <param name="expression">The property expression.</param>
-            /// <returns>The attribute, ready to be cast.</returns>
-            public TProperty Attr<TProperty>(Expression<Func<TContext, TProperty>> expression) {
-                var propertyInfo = ReflectionHelper<TContext>.GetPropertyInfo(expression);
-                var name = propertyInfo.Name;
-                return Element.Attr<TProperty>(name);
-            }
-        }
-    }
-}

File Models/Address.cs

 using System;
 using System.Xml.Linq;
-using Nwazet.Commerce.Helpers;
+using Orchard.ContentManagement;
 
 namespace Nwazet.Commerce.Models {
     public class Address {

File Models/DiscountPart.cs

 
 namespace Nwazet.Commerce.Models {
     [OrchardFeature("Nwazet.Promotions")]
-    public class DiscountPart : InfosetContentPart<DiscountPartRecord> {
+    public class DiscountPart : ContentPart<DiscountPartRecord> {
         public string Name { get { return Record.Name; } set { Record.Name = value; } }
 
         public double? DiscountPercent {

File Models/InfosetContentPart.cs

-using System;
-using System.Linq.Expressions;
-using Nwazet.Commerce.Helpers;
-using Orchard.ContentManagement;
-
-namespace Nwazet.Commerce.Models {
-    // These base classes won't be necessary any more once
-    // their methods are integrated into core's ContentPart and ContentPart<TRecord>.
-    public class InfosetContentPart<TRecord> : ContentPart<TRecord> {
-
-        protected TProperty Retrieve<TProperty>(Expression<Func<TRecord, TProperty>> targetExpression) {
-            return InfosetHelper.Retrieve(this, targetExpression);
-        }
-
-        protected TProperty Retrieve<TProperty>(
-            Expression<Func<TRecord, TProperty>> targetExpression,
-            Func<TRecord, TProperty> defaultExpression) {
-
-            return InfosetHelper.Retrieve(this, targetExpression, defaultExpression);
-        }
-
-        protected InfosetContentPart<TRecord> Store<TProperty>(
-            Expression<Func<TRecord, TProperty>> targetExpression,
-            TProperty value) {
-
-            InfosetHelper.Store(this, targetExpression, value);
-            return this;
-        }
-    }
-}

File Models/OrderPart.cs

 using System.Collections.Generic;
 using System.Linq;
 using System.Xml.Linq;
-using Nwazet.Commerce.Helpers;
 using Orchard.ContentManagement;
 using Orchard.ContentManagement.Aspects;
 using Orchard.Environment.Extensions;

File Models/ProductAttributePart.cs

 using System;
 using System.Collections.Generic;
 using System.Linq;
+using Orchard.ContentManagement;
 using Orchard.Environment.Extensions;
 
 namespace Nwazet.Commerce.Models {
     [OrchardFeature("Nwazet.Attributes")]
-    public class ProductAttributePart : InfosetContentPart<ProductAttributePartRecord> {
+    public class ProductAttributePart : ContentPart<ProductAttributePartRecord> {
         public IEnumerable<string> AttributeValues {
             get {
                 var values = AttributeValuesString;

File Models/ProductAttributesPart.cs

 using System;
 using System.Collections.Generic;
 using System.Linq;
+using Orchard.ContentManagement;
 using Orchard.Environment.Extensions;
 
 namespace Nwazet.Commerce.Models {
     [OrchardFeature("Nwazet.Attributes")]
-    public class ProductAttributesPart : InfosetContentPart<ProductAttributesPartRecord> {
+    public class ProductAttributesPart : ContentPart<ProductAttributesPartRecord> {
         public IEnumerable<int> AttributeIds {
             get {
                 var attributes = Retrieve(r => r.Attributes);

File Models/ProductPart.cs

 using System.ComponentModel.DataAnnotations;
+using Orchard.ContentManagement;
 using Orchard.Environment.Extensions;
 
 namespace Nwazet.Commerce.Models {
     [OrchardFeature("Nwazet.Commerce")]
-    public class ProductPart : InfosetContentPart<ProductPartRecord>, IProduct {
+    public class ProductPart : ContentPart<ProductPartRecord>, IProduct {
         [Required]
         public string Sku {
             get { return Retrieve(r => r.Sku); }

File Models/SizeBasedShippingMethodPart.cs

 using System.Linq;
 using Nwazet.Commerce.Services;
 using Orchard;
+using Orchard.ContentManagement;
 using Orchard.Environment.Extensions;
 
 namespace Nwazet.Commerce.Models {
     [OrchardFeature("Nwazet.Shipping")]
-    public class SizeBasedShippingMethodPart : InfosetContentPart<SizeBasedShippingMethodPartRecord>, IShippingMethod {
+    public class SizeBasedShippingMethodPart : ContentPart<SizeBasedShippingMethodPartRecord>, IShippingMethod {
         public string Name {
             get { return Retrieve(r => r.Name); }
             set { Store(r => r.Name, value); }

File Models/StateOrCountryTaxPart.cs

 using System;
 using System.Collections.Generic;
 using Nwazet.Commerce.Services;
+using Orchard.ContentManagement;
 using Orchard.Environment.Extensions;
 
 namespace Nwazet.Commerce.Models {
     [OrchardFeature("Nwazet.Taxes")]
-    public class StateOrCountryTaxPart : InfosetContentPart<StateOrCountryTaxPartRecord>, ITax {
+    public class StateOrCountryTaxPart : ContentPart<StateOrCountryTaxPartRecord>, ITax {
         public string State {
             get { return Retrieve(r => r.State); }
             set { Store(r => r.State, value); }

File Models/StripeSettingsPart.cs

 using System.ComponentModel.DataAnnotations;
-using Nwazet.Commerce.Helpers;
 using Orchard.ContentManagement;
 using Orchard.Environment.Extensions;
 
     public class StripeSettingsPart : ContentPart {
         [Required]
         public string PublishableKey {
-            get { return this.Retrieve<string>("PublishableKey"); }
-            set { this.Store("PublishableKey", value); }
+            get { return Retrieve<string>("PublishableKey"); }
+            set { Store("PublishableKey", value); }
         }
 
         public string SecretKey {
-            get { return this.Retrieve<string>("SecretKey"); }
-            set { this.Store("SecretKey", value); }
+            get { return Retrieve<string>("SecretKey"); }
+            set { Store("SecretKey", value); }
         }
 
         public string Currency {
-            get { return this.Retrieve<string>("Currency"); }
-            set { this.Store("Currency", value); }
+            get { return Retrieve<string>("Currency"); }
+            set { Store("Currency", value); }
         }
     }
 }

File Models/UspsSettingsPart.cs

-using Nwazet.Commerce.Helpers;
-using Orchard.ContentManagement;
+using Orchard.ContentManagement;
 using Orchard.Environment.Extensions;
 
 namespace Nwazet.Commerce.Models {
     [OrchardFeature("Usps.Shipping")]
     public class UspsSettingsPart : ContentPart {
         public string UserId {
-            get { return this.Retrieve<string>("UserId"); } 
-            set { this.Store("UserId", value); }
+            get { return Retrieve<string>("UserId"); } 
+            set { Store("UserId", value); }
         }
 
         public string OriginZip {
-            get { return this.Retrieve<string>("OriginZip"); }
-            set { this.Store("OriginZip", value); }
+            get { return Retrieve<string>("OriginZip"); }
+            set { Store("OriginZip", value); }
         }
 
         public bool CommercialPrices {
-            get { return this.Retrieve<bool>("CommercialPrices"); }
-            set { this.Store("CommercialPrices", value); }
+            get { return Retrieve<bool>("CommercialPrices"); }
+            set { Store("CommercialPrices", value); }
         }
 
         public bool CommercialPlusPrices {
-            get { return this.Retrieve<bool>("CommercialPlusPrices"); }
-            set { this.Store("CommercialPlusPrices", value); }
+            get { return Retrieve<bool>("CommercialPlusPrices"); }
+            set { Store("CommercialPlusPrices", value); }
         }
     }
 }

File Models/UspsShippingMethodPart.cs

 using System.Linq;
 using Nwazet.Commerce.Services;
 using Orchard;
+using Orchard.ContentManagement;
 using Orchard.Environment.Extensions;
 
 namespace Nwazet.Commerce.Models {
     [OrchardFeature("Usps.Shipping")]
-    public class UspsShippingMethodPart : InfosetContentPart<UspsShippingMethodPartRecord>, IShippingMethod {
+    public class UspsShippingMethodPart : ContentPart<UspsShippingMethodPartRecord>, IShippingMethod {
         public string Name {
             get { return Retrieve(r => r.Name); }
             set { Store(r => r.Name, value); }

File Models/WeightBasedShippingMethodPart.cs

 using System.Linq;
 using Nwazet.Commerce.Services;
 using Orchard;
+using Orchard.ContentManagement;
 using Orchard.Environment.Extensions;
 
 namespace Nwazet.Commerce.Models {
     [OrchardFeature("Nwazet.Shipping")]
-    public class WeightBasedShippingMethodPart : InfosetContentPart<WeightBasedShippingMethodPartRecord>,
+    public class WeightBasedShippingMethodPart : ContentPart<WeightBasedShippingMethodPartRecord>,
         IShippingMethod {
         public string Name {
             get { return Retrieve(r => r.Name); }

File Nwazet.Commerce.Tests/InfosetHelperTests.cs

-using NUnit.Framework;
-using Nwazet.Commerce.Models;
-using Nwazet.Commerce.Tests.Helpers;
-using Orchard.ContentManagement;
-using Nwazet.Commerce.Helpers;
-using Orchard.ContentManagement.FieldStorage.InfosetStorage;
-using Orchard.ContentManagement.Records;
-
-namespace Nwazet.Commerce.Tests {
-    public class InfosetHelperTests {
-        [Test]
-        public void StoreByNameSavesIntoInfoset() {
-            var part = new TestPart();
-            ContentHelpers.PreparePart(part, "Test");
-            part.Foo = 42;
-            var infosetXml = part.As<InfosetPart>().Infoset.Element;
-            var testPartElement = infosetXml.Element(typeof (TestPart).Name);
-            Assert.That(testPartElement, Is.Not.Null);
-            var fooAttribute = testPartElement.Attr<int>("Foo");
-
-            Assert.That(part.Foo, Is.EqualTo(42));
-            Assert.That(fooAttribute, Is.EqualTo(42));
-        }
-
-        [Test]
-        public void RetrieveSavesIntoInfoset() {
-            var part = new TestPartWithRecord();
-            ContentHelpers.PreparePart<TestPartWithRecord, TestPartWithRecordRecord>(part, "Test");
-            part.Record.Foo = 42;
-            var infosetXml = part.As<InfosetPart>().Infoset.Element;
-            var testPartElement = infosetXml.Element(typeof (TestPartWithRecord).Name);
-            Assert.That(testPartElement, Is.Null);
-
-            var foo = part.Foo;
-            testPartElement = infosetXml.Element(typeof(TestPartWithRecord).Name);
-            Assert.That(testPartElement, Is.Not.Null);
-            var fooAttribute = testPartElement.Attr<int>("Foo");
-
-            Assert.That(foo, Is.EqualTo(42));
-            Assert.That(fooAttribute, Is.EqualTo(42));
-        }
-
-        public class TestPart : ContentPart {
-            public int Foo {
-                get { return this.Retrieve<int>("Foo"); }
-                set { this.Store("Foo", value); }
-            }
-        }
-
-        public class TestPartWithRecordRecord : ContentPartRecord {
-            public virtual int Foo { get; set; }
-        }
-
-        public class TestPartWithRecord : InfosetContentPart<TestPartWithRecordRecord> {
-            public int Foo {
-                get { return Retrieve(r => r.Foo); }
-                set { Store(r => r.Foo, value); }
-            }
-        }
-    }
-}

File Nwazet.Commerce.Tests/Nwazet.Commerce.Tests.csproj

     <Compile Include="Helpers\ContentHelpers.cs" />
     <Compile Include="Helpers\ShippingHelpers.cs" />
     <Compile Include="Helpers\ShoppingCartHelpers.cs" />
-    <Compile Include="InfosetHelperTests.cs" />
     <Compile Include="ShippingServiceTest.cs" />
     <Compile Include="TaxTests.cs" />
     <Compile Include="UspsServiceInternationalTests.cs" />
     <Compile Include="UspsShippingMethodPartDriverTests.cs" />
     <Compile Include="WeightBasedShippingMethodTest.cs" />
     <Compile Include="Stubs\WorkContextAccessorStub.cs" />
-    <Compile Include="XmlHelperTests.cs" />
   </ItemGroup>
   <ItemGroup>
     <ProjectReference Include="..\..\..\..\Orchard\Orchard.Framework.csproj">

File Nwazet.Commerce.Tests/UspsShippingMethodPartDriverTests.cs

 using System.Xml.Linq;
 using NUnit.Framework;
 using Nwazet.Commerce.Drivers;
-using Nwazet.Commerce.Helpers;
 using Nwazet.Commerce.Models;
 using Nwazet.Commerce.Tests.Helpers;
 using Orchard.ContentManagement;

File Nwazet.Commerce.Tests/XmlHelperTests.cs

-using System;
-using System.Linq;
-using System.Xml.Linq;
-using NUnit.Framework;
-using Nwazet.Commerce.Helpers;
-
-namespace Nwazet.Commerce.Tests {
-    [TestFixture]
-    public class XmlHelperTests {
-        [Test]
-        public void AddEl() {
-            var el = new XElement("data");
-            el
-                .AddEl(new XElement("node1"), new XElement("node2"))
-                .AddEl(new XElement("node3"));
-
-            Assert.That(el.Descendants().Count(), Is.EqualTo(3));
-            Assert.That(el.Descendants().First().Name.ToString(), Is.EqualTo("node1"));
-            Assert.That(el.Descendants().ElementAt(1).Name.ToString(), Is.EqualTo("node2"));
-            Assert.That(el.Descendants().ElementAt(2).Name.ToString(), Is.EqualTo("node3"));
-        }
-
-        [Test]
-        public void Val() {
-            var el = new XElement("data");
-            el = el.Val(123);
-            var val = el.Val<int>();
-
-            Assert.That(val, Is.EqualTo(123));
-            Assert.That(el.ToString(SaveOptions.DisableFormatting),
-                Is.EqualTo("<data>123</data>"));
-        }
-
-        [Test]
-        public void Infinities() {
-            var el = new XElement("data")
-                .Attr("doubleplus", double.PositiveInfinity)
-                .Attr("doubleminus", double.NegativeInfinity)
-                .Attr("floatplus", float.PositiveInfinity)
-                .Attr("floatminus", float.NegativeInfinity);
-
-            Assert.That(el.Attr<string>("doubleplus"), Is.EqualTo("infinity"));
-            Assert.That(el.Attr<string>("doubleminus"), Is.EqualTo("-infinity"));
-            Assert.That(el.Attr<string>("floatplus"), Is.EqualTo("infinity"));
-            Assert.That(el.Attr<string>("floatminus"), Is.EqualTo("-infinity"));
-
-            Assert.That(double.IsPositiveInfinity(el.Attr<double>("doubleplus")), Is.True);
-            Assert.That(double.IsNegativeInfinity(el.Attr<double>("doubleminus")), Is.True);
-            Assert.That(double.IsPositiveInfinity(el.Attr<float>("floatplus")), Is.True);
-            Assert.That(double.IsNegativeInfinity(el.Attr<float>("floatminus")), Is.True);
-        }
-
-        [Test]
-        public void StringToAttribute() {
-            var el = new XElement("data");
-            el.Attr("foo", "bar");
-
-            Assert.That(el.Attribute("foo").Value, Is.EqualTo("bar"));
-        }
-
-        [Test]
-        public void IntToAttribute() {
-            var el = new XElement("data");
-            el.Attr("foo", 42);
-
-            Assert.That(el.Attribute("foo").Value, Is.EqualTo("42"));
-        }
-
-        [Test]
-        public void BoolToAttribute() {
-            var el = new XElement("data");
-            el.Attr("foo", true);
-            el.Attr("bar", false);
-
-            Assert.That(el.Attribute("foo").Value, Is.EqualTo("true"));
-            Assert.That(el.Attribute("bar").Value, Is.EqualTo("false"));
-        }
-
-        [Test]
-        public void DateTimeToAttribute() {
-            var el = new XElement("data");
-            el.Attr("foo", new DateTime(1970, 5, 21, 13, 55, 21, 934, DateTimeKind.Utc));
-
-            Assert.That(el.Attribute("foo").Value, Is.EqualTo("1970-05-21T13:55:21.934Z"));
-        }
-
-        [Test]
-        public void DoubleFloatDecimalToAttribute() {
-            var el = new XElement("data");
-            el.Attr("double", 12.456D);
-            el.Attr("float", 12.457F);
-            el.Attr("decimal", 12.458M);
-
-            Assert.That(el.Attribute("double").Value, Is.EqualTo("12.456"));
-            Assert.That(el.Attribute("float").Value, Is.EqualTo("12.457"));
-            Assert.That(el.Attribute("decimal").Value, Is.EqualTo("12.458"));
-        }
-
-        [Test]
-        public void ReadAttribute() {
-            var el = XElement.Parse("<data foo=\"bar\"/>");
-
-            Assert.That(el.Attr("foo"), Is.EqualTo("bar"));
-            Assert.That(el.Attr("bar"), Is.Null);
-        }
-
-        [Test]
-        public void StringToElement() {
-            var el = new XElement("data");
-            el.El("foo", "bar");
-
-            Assert.That(el.Element("foo").Value, Is.EqualTo("bar"));
-        }
-
-        [Test]
-        public void IntToElement() {
-            var el = new XElement("data");
-            el.El("foo", 42);
-
-            Assert.That(el.Element("foo").Value, Is.EqualTo("42"));
-        }
-
-        [Test]
-        public void BoolToElement() {
-            var el = new XElement("data");
-            el.El("foo", true);
-            el.El("bar", false);
-
-            Assert.That(el.Element("foo").Value, Is.EqualTo("true"));
-            Assert.That(el.Element("bar").Value, Is.EqualTo("false"));
-        }
-
-        [Test]
-        public void DateTimeToElement() {
-            var el = new XElement("data");
-            el.El("foo", new DateTime(1970, 5, 21, 13, 55, 21, 934, DateTimeKind.Utc));
-
-            Assert.That(el.Element("foo").Value, Is.EqualTo("1970-05-21T13:55:21.934Z"));
-        }
-
-        [Test]
-        public void DoubleFloatDecimalToElement() {
-            var el = new XElement("data");
-            el.El("double", 12.456D);
-            el.El("float", 12.457F);
-            el.El("decimal", 12.458M);
-
-            Assert.That(el.Element("double").Value, Is.EqualTo("12.456"));
-            Assert.That(el.Element("float").Value, Is.EqualTo("12.457"));
-            Assert.That(el.Element("decimal").Value, Is.EqualTo("12.458"));
-        }
-
-        [Test]
-        public void ReadElement() {
-            var el = XElement.Parse("<data><foo>bar</foo></data>");
-
-            Assert.That(el.El("foo"), Is.EqualTo("bar"));
-            Assert.That(el.El("bar"), Is.Null);
-        }
-
-        [Test]
-        public void SerializeObject() {
-            var target = new Target {
-                AString = "foo",
-                AnInt = 42,
-                ABoolean = true,
-                ADate = new DateTime(1970, 5, 21, 13, 55, 21, 934, DateTimeKind.Utc),
-                ADouble = 12.345D,
-                AFloat = 23.456F,
-                ADecimal = 34.567M,
-                ANullableInt = 42,
-                ANullableBoolean = true,
-                ANullableDate = new DateTime(1970, 5, 21, 13, 55, 21, 934, DateTimeKind.Utc),
-                ANullableDouble = 12.345D,
-                ANullableFloat = 23.456F,
-                ANullableDecimal = 34.567M
-            };
-            var el = new XElement("data");
-            el.With(target)
-                .ToAttr(t => t.AString)
-                .ToAttr(t => t.AnInt)
-                .ToAttr(t => t.ABoolean)
-                .ToAttr(t => t.ADate)
-                .ToAttr(t => t.ADouble)
-                .ToAttr(t => t.AFloat)
-                .ToAttr(t => t.ADecimal)
-                .ToAttr(t => t.ANullableInt)
-                .ToAttr(t => t.ANullableBoolean)
-                .ToAttr(t => t.ANullableDate)
-                .ToAttr(t => t.ANullableDouble)
-                .ToAttr(t => t.ANullableFloat)
-                .ToAttr(t => t.ANullableDecimal);
-
-
-            Assert.That(el.Attr("AString"), Is.EqualTo("foo"));
-            Assert.That(el.Attr("AnInt"), Is.EqualTo("42"));
-            Assert.That(el.Attr("ABoolean"), Is.EqualTo("true"));
-            Assert.That(el.Attr("ADate"), Is.EqualTo("1970-05-21T13:55:21.934Z"));
-            Assert.That(el.Attr("ADouble"), Is.EqualTo("12.345"));
-            Assert.That(el.Attr("AFloat"), Is.EqualTo("23.456"));
-            Assert.That(el.Attr("ADecimal"), Is.EqualTo("34.567"));
-            Assert.That(el.Attr("ANullableInt"), Is.EqualTo("42"));
-            Assert.That(el.Attr("ANullableBoolean"), Is.EqualTo("true"));
-            Assert.That(el.Attr("ANullableDate"), Is.EqualTo("1970-05-21T13:55:21.934Z"));
-            Assert.That(el.Attr("ANullableDouble"), Is.EqualTo("12.345"));
-            Assert.That(el.Attr("ANullableFloat"), Is.EqualTo("23.456"));
-            Assert.That(el.Attr("ANullableDecimal"), Is.EqualTo("34.567"));
-        }
-
-        [Test]
-        public void DeSerializeObject() {
-            var target = new Target();
-            var el =
-                XElement.Parse(
-                    "<data AString=\"foo\" AnInt=\"42\" ABoolean=\"true\" " +
-                    "ADate=\"1970-05-21T13:55:21.934Z\" ADouble=\"12.345\" " +
-                    "AFloat=\"23.456\" ADecimal=\"34.567\" " +
-                    "ANullableInt=\"42\" ANullableBoolean=\"true\" " +
-                    "ANullableDate=\"1970-05-21T13:55:21.934Z\" ANullableDouble=\"12.345\" " +
-                    "ANullableFloat=\"23.456\" ANullableDecimal=\"34.567\"/>");
-            el.With(target)
-                .FromAttr(t => t.AString)
-                .FromAttr(t => t.AnInt)
-                .FromAttr(t => t.ABoolean)
-                .FromAttr(t => t.ADate)
-                .FromAttr(t => t.ADouble)
-                .FromAttr(t => t.AFloat)
-                .FromAttr(t => t.ADecimal)
-                .FromAttr(t => t.ANullableInt)
-                .FromAttr(t => t.ANullableBoolean)
-                .FromAttr(t => t.ANullableDate)
-                .FromAttr(t => t.ANullableDouble)
-                .FromAttr(t => t.ANullableFloat)
-                .FromAttr(t => t.ANullableDecimal);
-
-            Assert.That(target.AString, Is.EqualTo("foo"));
-            Assert.That(target.AnInt, Is.EqualTo(42));
-            Assert.That(target.ABoolean, Is.True);
-            Assert.That(target.ADate, Is.EqualTo(new DateTime(1970, 5, 21, 13, 55, 21, 934, DateTimeKind.Utc)));
-            Assert.That(target.ADouble, Is.EqualTo(12.345D));
-            Assert.That(target.AFloat, Is.EqualTo(23.456F));
-            Assert.That(target.ADecimal, Is.EqualTo(34.567M));
-            Assert.That(target.ANullableInt, Is.EqualTo(42));
-            Assert.That(target.ANullableBoolean, Is.True);
-            Assert.That(target.ANullableDate, Is.EqualTo(new DateTime(1970, 5, 21, 13, 55, 21, 934, DateTimeKind.Utc)));
-            Assert.That(target.ANullableDouble, Is.EqualTo(12.345D));
-            Assert.That(target.ANullableFloat, Is.EqualTo(23.456F));
-            Assert.That(target.ANullableDecimal, Is.EqualTo(34.567M));
-        }
-
-        [Test]
-        public void DeSerializeFromMissingAttributeLeavesValueIntact() {
-            var target = new Target {
-                AString = "foo",
-                AnInt = 42,
-                ABoolean = true,
-                ADate = new DateTime(1970, 5, 21, 13, 55, 21, 934, DateTimeKind.Utc),
-                ADouble = 12.345D,
-                AFloat = 23.456F,
-                ADecimal = 34.567M,
-                ANullableInt = 42,
-                ANullableBoolean = true,
-                ANullableDate = new DateTime(1970, 5, 21, 13, 55, 21, 934, DateTimeKind.Utc),
-                ANullableDouble = 12.345D,
-                ANullableFloat = 23.456F,
-                ANullableDecimal = 34.567M
-            };
-            var el = new XElement("data");
-            el.With(target)
-                .FromAttr(t => t.AString)
-                .FromAttr(t => t.AnInt)
-                .FromAttr(t => t.ABoolean)
-                .FromAttr(t => t.ADate)
-                .FromAttr(t => t.ADouble)
-                .FromAttr(t => t.AFloat)
-                .FromAttr(t => t.ADecimal)
-                .FromAttr(t => t.ANullableInt)
-                .FromAttr(t => t.ANullableBoolean)
-                .FromAttr(t => t.ANullableDate)
-                .FromAttr(t => t.ANullableDouble)
-                .FromAttr(t => t.ANullableFloat)
-                .FromAttr(t => t.ANullableDecimal);
-
-            Assert.That(target.AString, Is.EqualTo("foo"));
-            Assert.That(target.AnInt, Is.EqualTo(42));
-            Assert.That(target.ABoolean, Is.True);
-            Assert.That(target.ADate, Is.EqualTo(new DateTime(1970, 5, 21, 13, 55, 21, 934, DateTimeKind.Utc)));
-            Assert.That(target.ADouble, Is.EqualTo(12.345D));
-            Assert.That(target.AFloat, Is.EqualTo(23.456F));
-            Assert.That(target.ADecimal, Is.EqualTo(34.567M));
-            Assert.That(target.ANullableInt, Is.EqualTo(42));
-            Assert.That(target.ANullableBoolean, Is.True);
-            Assert.That(target.ANullableDate, Is.EqualTo(new DateTime(1970, 5, 21, 13, 55, 21, 934, DateTimeKind.Utc)));
-            Assert.That(target.ANullableDouble, Is.EqualTo(12.345D));
-            Assert.That(target.ANullableFloat, Is.EqualTo(23.456F));
-            Assert.That(target.ANullableDecimal, Is.EqualTo(34.567M));
-        }
-
-        [Test]
-        public void AttrWithContext() {
-            var el = new XElement("data")
-                .With(new {foo = 123})
-                .ToAttr(o => o.foo);
-            var val = el.Attr(o => o.foo);
-
-            Assert.That(val, Is.EqualTo(123));
-        }
-
-        [Test]
-        public void ContextSwitch() {
-            var el = new XElement("data");
-            el.With(new {foo = "bar"})
-                .ToAttr(o => o.foo)
-                .With(new {bar = "baz"})
-                .ToAttr(o => o.bar);
-
-            Assert.That(el.Attr<string>("foo"), Is.EqualTo("bar"));
-            Assert.That(el.Attr<string>("bar"), Is.EqualTo("baz"));
-        }
-
-        [Test]
-        public void ImplicitConversion() {
-            var el = new XElement("data")
-                .With(new {foo = "bar"})
-                .ToAttr(o => o.foo);
-            Func<XElement, string> func = e => e.Attr<string>("foo");
-
-            Assert.That(func(el), Is.EqualTo("bar"));
-        }
-
-        [Test]
-        public void NullSerializes() {
-            var target = new Target();
-            var el = new XElement("data");
-            el.With(target)
-                .ToAttr(t => t.AString)
-                .ToAttr(t => t.ANullableInt)
-                .ToAttr(t => t.ANullableBoolean)
-                .ToAttr(t => t.ANullableDate)
-                .ToAttr(t => t.ANullableDouble)
-                .ToAttr(t => t.ANullableFloat)
-                .ToAttr(t => t.ANullableDecimal);
-
-            Assert.That(el.Attr("AString"), Is.EqualTo(""));
-            Assert.That(el.Attr("ANullableInt"), Is.EqualTo("null"));
-            Assert.That(el.Attr("ANullableBoolean"), Is.EqualTo("null"));
-            Assert.That(el.Attr("ANullableDate"), Is.EqualTo("null"));
-            Assert.That(el.Attr("ANullableDouble"), Is.EqualTo("null"));
-            Assert.That(el.Attr("ANullableFloat"), Is.EqualTo("null"));
-            Assert.That(el.Attr("ANullableDecimal"), Is.EqualTo("null"));
-        }
-
-        [Test]
-        public void DeSerializeNull() {
-            var target = new Target();
-            var el =
-                XElement.Parse(
-                    "<data AString=\"null\" ANullableInt=\"null\" ANullableBoolean=\"null\" " +
-                    "ANullableDate=\"null\" ANullableDouble=\"null\" " +
-                    "ANullableFloat=\"null\" ANullableDecimal=\"null\"/>");
-            el.With(target)
-                .FromAttr(t => t.AString)
-                .FromAttr(t => t.ANullableInt)
-                .FromAttr(t => t.ANullableBoolean)
-                .FromAttr(t => t.ANullableDate)
-                .FromAttr(t => t.ANullableDouble)
-                .FromAttr(t => t.ANullableFloat)
-                .FromAttr(t => t.ANullableDecimal);
-
-            Assert.That(target.AString, Is.EqualTo("null"));
-            Assert.That(target.ANullableInt, Is.Null);
-            Assert.That(target.ANullableBoolean, Is.Null);
-            Assert.That(target.ANullableDate, Is.Null);
-            Assert.That(target.ANullableDouble, Is.Null);
-            Assert.That(target.ANullableFloat, Is.Null);
-            Assert.That(target.ANullableDecimal, Is.Null);
-        }
-
-        private class Target {
-            public string AString { get; set; }
-            public int AnInt { get; set; }
-            public bool ABoolean { get; set; }
-            public DateTime ADate { get; set; }
-            public double ADouble { get; set; }
-            public float AFloat { get; set; }
-            public decimal ADecimal { get; set; }
-            public int? ANullableInt { get; set; }
-            public bool? ANullableBoolean { get; set; }
-            public DateTime? ANullableDate { get; set; }
-            public double? ANullableDouble { get; set; }
-            public float? ANullableFloat { get; set; }
-            public decimal? ANullableDecimal { get; set; }
-        }
-    }
-}

File Nwazet.Commerce.csproj

     <Compile Include="Handlers\WeightBasedShippingMethodPartHandler.cs" />
     <Compile Include="Handlers\GoogleCheckoutSettingsPartHandler.cs" />
     <Compile Include="Handlers\ProductPartHandler.cs" />
-    <Compile Include="Helpers\InfosetHelper.cs" />
-    <Compile Include="Helpers\ReflectionHelper.cs" />
-    <Compile Include="Helpers\XmlHelper.cs" />
     <Compile Include="Menus\AttributeAdminMenu.cs" />
     <Compile Include="Menus\OrderAdminMenu.cs" />
     <Compile Include="Menus\TaxAdminMenu.cs" />
     <Compile Include="Migrations\GoogleCheckoutMigrations.cs" />
     <Compile Include="Models\Address.cs" />
     <Compile Include="Models\CheckoutItem.cs" />
-    <Compile Include="Models\InfosetContentPart.cs" />
     <Compile Include="Models\OrderEvent.cs" />
     <Compile Include="Models\OrderPart.cs" />
     <Compile Include="Models\OrderPartRecord.cs" />