Example #1
0
        public static void AddDefaultConverters(IConverterRegistry converterRegistry)
        {
            AddScalarConverters(converterRegistry);
            AddCollectionConverters(converterRegistry);

            converterRegistry.AddConverter(new ObjectToObjectConverter());

            converterRegistry.AddConverter(new FallbackObjectToStringConverter());
        }
Example #2
0
        private static void AddScalarConverters(IConverterRegistry converterRegistry)
        {
            converterRegistry.AddConverter(new NumberToNumberConverter());
            converterRegistry.AddConverter(new StringToNumberConverter());

            converterRegistry.AddConverter(new NumberToStringConverter());

            converterRegistry.AddConverter(new StringToCharacterConverter());
            converterRegistry.AddConverter(new CharacterToStringConverter());

            converterRegistry.AddConverter(new NumberToCharacterConverter());
            converterRegistry.AddConverter(new CharacterToNumberConverter());

            converterRegistry.AddConverter(new StringToBooleanConverter());
            converterRegistry.AddConverter(new BooleanToStringConverter());

            converterRegistry.AddConverter(new StringToEnumConverter());
            converterRegistry.AddConverter(new EnumToStringConverter());

            converterRegistry.AddConverter(new StringToEncodingConverter());
            converterRegistry.AddConverter(new EncodingToStringConverter());

            converterRegistry.AddConverter(new StringToGuidConverter());
            converterRegistry.AddConverter(new GuidToStringConverter());

            converterRegistry.AddConverter(new ObjectToNumberConverter());
        }
Example #3
0
        public static void AddCollectionConverters(IConverterRegistry converterRegistry)
        {
            var conversionService = (IConversionService)converterRegistry;

            converterRegistry.AddConverter(new ListToDictionaryConverter(conversionService));

            converterRegistry.AddConverter(new ArrayToCollectionConverter(conversionService));
            converterRegistry.AddConverter(new CollectionToArrayConverter(conversionService));

            converterRegistry.AddConverter(new ArrayToArrayConverter(conversionService));

            converterRegistry.AddConverter(new CollectionToCollectionConverter(conversionService));

            converterRegistry.AddConverter(new DictionaryToDictionaryConverter(conversionService));
            converterRegistry.AddConverter(new ArrayToStringConverter(conversionService));
            converterRegistry.AddConverter(new StringToArrayConverter(conversionService));

            converterRegistry.AddConverter(new ArrayToObjectConverter(conversionService));
            converterRegistry.AddConverter(new ObjectToArrayConverter(conversionService));

            converterRegistry.AddConverter(new CollectionToStringConverter(conversionService));
            converterRegistry.AddConverter(new StringToCollectionConverter(conversionService));

            converterRegistry.AddConverter(new CollectionToObjectConverter(conversionService));

            converterRegistry.AddConverter(new ObjectToCollectionConverter(conversionService));
        }