Example #1
0
        public override AdoTypeConverter Initialize(IDataColumn user, Type clr, IAdoTypeConverterRegistry registry, bool secondaryTable)
        {
            if (clr != DefaultType)
            {
                throw new ArgumentOutOfRangeException(nameof(clr), $"{GetType().FullName} converter is not compatible with properties of type {clr.Name}.");
            }

            return(base.Initialize(user, clr, registry, secondaryTable));
        }
        public override AdoTypeConverter Initialize(IDataColumn user, Type clr, IAdoTypeConverterRegistry registry, bool secondaryTable)
        {
            //first we need to ensure that the generic type specified is an Enum.
            if (!DefaultType.IsEnum)
            {
                throw new System.ArgumentException(typeof(TEnum).Name + " is not an Enum");
            }

            //second we need to make sure OpenAccess is looking for the Enum this converter handles.
            if (clr == typeof(TEnum))
            {
                return(base.Initialize(user, clr, registry, secondaryTable));
            }
            return(null);
        }