Пример #1
0
        public Object Convert(Object item, TypeConversionDirection direction)
        {
            var conversionMethodName = String.Empty;

            switch (direction)
            {
            case TypeConversionDirection.DatabaseToProperty:
            {
                conversionMethodName = ConversionToPropertyMethodName;
            }
            break;

            case TypeConversionDirection.PropertyToDatabase:
            {
                conversionMethodName = ConversionToDatabaseMethodName;
            }
            break;

            default:
                throw new NotImplementedException("Not a valid TypeConversionDirection.");
            }

            return(ConverterClass.InvokeMember(
                       conversionMethodName,
                       BindingFlags.InvokeMethod,
                       null,
                       null,
                       new[] { item }
                       ));
        }