private static void CreateDefaultConverters()
        {
            _typeConverters.TryAdd(typeof(DateTime), new DateTimeConverter());
            _typeConverters.TryAdd(typeof(TimeSpan), new TimeSpanConverter());
            _typeConverters.TryAdd(typeof(bool), new BooleanConverter(
                                       new [] { "yes", "y", "on", "wahr" },
                                       new [] { "no", "n", "off", "falsch" }));

            ITypeConverter converter = new ShippingOptionConverter(true);

            _typeConverters.TryAdd(typeof(IList <ShippingOption>), converter);
            _typeConverters.TryAdd(typeof(List <ShippingOption>), converter);
            _typeConverters.TryAdd(typeof(ShippingOption), new ShippingOptionConverter(false));

            converter = new ProductBundleDataConverter(true);
            _typeConverters.TryAdd(typeof(IList <ProductBundleItemOrderData>), converter);
            _typeConverters.TryAdd(typeof(List <ProductBundleItemOrderData>), converter);
            _typeConverters.TryAdd(typeof(ProductBundleItemOrderData), new ProductBundleDataConverter(false));

            converter = new DictionaryTypeConverter <IDictionary <string, object> >();
            _typeConverters.TryAdd(typeof(IDictionary <string, object>), converter);
            _typeConverters.TryAdd(typeof(Dictionary <string, object>), converter);
            _typeConverters.TryAdd(typeof(RouteValueDictionary), new DictionaryTypeConverter <RouteValueDictionary>());
            _typeConverters.TryAdd(typeof(ExpandoObject), new DictionaryTypeConverter <ExpandoObject>());

            _typeConverters.TryAdd(typeof(EmailAddress), new EmailAddressConverter());
        }
예제 #2
0
        private static void CreateDefaultConverters()
        {
            _typeConverters.TryAdd(typeof(DateTime), new DateTimeConverter());
            _typeConverters.TryAdd(typeof(TimeSpan), new TimeSpanConverter());
            _typeConverters.TryAdd(typeof(bool), new BooleanConverter(
                                       new [] { "yes", "y", "on", "wahr" },
                                       new [] { "no", "n", "off", "falsch" }));

            ITypeConverter converter = new ShippingOptionConverter(true);

            _typeConverters.TryAdd(typeof(IList <ShippingOption>), converter);
            _typeConverters.TryAdd(typeof(List <ShippingOption>), converter);
            _typeConverters.TryAdd(typeof(ShippingOption), new ShippingOptionConverter(false));

            converter = new ProductBundleDataConverter(true);
            _typeConverters.TryAdd(typeof(IList <ProductBundleItemOrderData>), converter);
            _typeConverters.TryAdd(typeof(List <ProductBundleItemOrderData>), converter);
            _typeConverters.TryAdd(typeof(ProductBundleItemOrderData), new ProductBundleDataConverter(false));
        }