コード例 #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="TypeHandlerFactory"/> class.
        /// </summary>
        public TypeHandlerFactory()
        {
            ITypeHandler handler = null;

            handler = new DBNullTypeHandler();
            Register(typeof(DBNull), handler);

            handler = new BooleanTypeHandler();
            Register(typeof(bool), handler);             // key= "System.Boolean"

            handler = new ByteTypeHandler();
            Register(typeof(Byte), handler);

            handler = new CharTypeHandler();
            Register(typeof(Char), handler);

            handler = new DateTimeTypeHandler();
            Register(typeof(DateTime), handler);

            handler = new DecimalTypeHandler();
            Register(typeof(Decimal), handler);

            handler = new DoubleTypeHandler();
            Register(typeof(Double), handler);

            handler = new Int16TypeHandler();
            Register(typeof(Int16), handler);

            handler = new Int32TypeHandler();
            Register(typeof(Int32), handler);

            handler = new Int64TypeHandler();
            Register(typeof(Int64), handler);

            handler = new SingleTypeHandler();
            Register(typeof(Single), handler);

            handler = new StringTypeHandler();
            Register(typeof(String), handler);

            handler = new GuidTypeHandler();
            Register(typeof(Guid), handler);

            handler = new TimeSpanTypeHandler();
            Register(typeof(TimeSpan), handler);

            handler = new ByteArrayTypeHandler();
            Register(typeof(Byte[]), handler);

            handler = new ObjectTypeHandler();
            Register(typeof(object), handler);

            handler = new EnumTypeHandler();
            Register(typeof(Enum), handler);

            handler = new UInt16TypeHandler();
            Register(typeof(UInt16), handler);

            handler = new UInt32TypeHandler();
            Register(typeof(UInt32), handler);

            handler = new UInt64TypeHandler();
            Register(typeof(UInt64), handler);

            handler = new SByteTypeHandler();
            Register(typeof(SByte), handler);

            handler = new NullableBooleanTypeHandler();
            Register(typeof(bool?), handler);

            handler = new NullableByteTypeHandler();
            Register(typeof(byte?), handler);

            handler = new NullableCharTypeHandler();
            Register(typeof(char?), handler);

            handler = new NullableDateTimeTypeHandler();
            Register(typeof(DateTime?), handler);

            handler = new NullableDecimalTypeHandler();
            Register(typeof(decimal?), handler);

            handler = new NullableDoubleTypeHandler();
            Register(typeof(double?), handler);

            handler = new NullableGuidTypeHandler();
            Register(typeof(Guid?), handler);

            handler = new NullableInt16TypeHandler();
            Register(typeof(Int16?), handler);

            handler = new NullableInt32TypeHandler();
            Register(typeof(Int32?), handler);

            handler = new NullableInt64TypeHandler();
            Register(typeof(Int64?), handler);

            handler = new NullableSingleTypeHandler();
            Register(typeof(Single?), handler);

            handler = new NullableUInt16TypeHandler();
            Register(typeof(UInt16?), handler);

            handler = new NullableUInt32TypeHandler();
            Register(typeof(UInt32?), handler);

            handler = new NullableUInt64TypeHandler();
            Register(typeof(UInt64?), handler);

            handler = new NullableSByteTypeHandler();
            Register(typeof(SByte?), handler);

            handler = new NullableTimeSpanTypeHandler();
            Register(typeof(TimeSpan?), handler);

            unknownTypeHandler = new UnknownTypeHandler(this);
        }
コード例 #2
0
ファイル: TypeHandlerFactory.cs プロジェクト: reckcn/CSharp
        /// <summary>
        /// Initializes a new instance of the <see cref="TypeHandlerFactory"/> class.
        /// </summary>
		public TypeHandlerFactory() 
		{
			ITypeHandler handler = null;

			handler = new DBNullTypeHandler();
			Register(typeof(DBNull), handler);

			handler = new BooleanTypeHandler();
			Register(typeof(bool), handler); // key= "System.Boolean"

			handler = new ByteTypeHandler();
			Register(typeof(Byte), handler);

			handler = new CharTypeHandler();
			Register(typeof(Char), handler);

			handler = new DateTimeTypeHandler();
			Register(typeof(DateTime), handler);

			handler = new DecimalTypeHandler();
			Register(typeof(Decimal), handler);

			handler = new DoubleTypeHandler();
			Register(typeof(Double), handler);

			handler = new Int16TypeHandler();
			Register(typeof(Int16), handler);

			handler = new Int32TypeHandler();
			Register(typeof(Int32), handler);

			handler = new Int64TypeHandler();
			Register(typeof(Int64), handler);

			handler = new SingleTypeHandler();
			Register(typeof(Single), handler);

			handler = new StringTypeHandler();
			Register(typeof(String), handler);

			handler = new GuidTypeHandler();
			Register(typeof(Guid), handler);

			handler = new TimeSpanTypeHandler();
			Register(typeof(TimeSpan), handler);

			handler = new ByteArrayTypeHandler();
			Register(typeof(Byte[]), handler);

			handler = new ObjectTypeHandler();
			Register(typeof(object), handler);

			handler = new EnumTypeHandler();
			Register( typeof(Enum), handler);

            handler = new UInt16TypeHandler();
            Register(typeof(UInt16), handler);

            handler = new UInt32TypeHandler();
            Register(typeof(UInt32), handler);

            handler = new UInt64TypeHandler();
            Register(typeof(UInt64), handler);

            handler = new SByteTypeHandler();
            Register(typeof(SByte), handler);
		    
            handler = new NullableBooleanTypeHandler();
            Register(typeof(bool?), handler);

            handler = new NullableByteTypeHandler();
            Register(typeof(byte?), handler);

            handler = new NullableCharTypeHandler();
            Register(typeof(char?), handler);

            handler = new NullableDateTimeTypeHandler();
            Register(typeof(DateTime?), handler);

            handler = new NullableDecimalTypeHandler();
            Register(typeof(decimal?), handler);

            handler = new NullableDoubleTypeHandler();
            Register(typeof(double?), handler);

            handler = new NullableGuidTypeHandler();
            Register(typeof(Guid?), handler);

            handler = new NullableInt16TypeHandler();
            Register(typeof(Int16?), handler);
            
            handler = new NullableInt32TypeHandler();
            Register(typeof(Int32?), handler);

            handler = new NullableInt64TypeHandler();
            Register(typeof(Int64?), handler);

            handler = new NullableSingleTypeHandler();
            Register(typeof(Single?), handler);

            handler = new NullableUInt16TypeHandler();
            Register(typeof(UInt16?), handler);

            handler = new NullableUInt32TypeHandler();
            Register(typeof(UInt32?), handler);

            handler = new NullableUInt64TypeHandler();
            Register(typeof(UInt64?), handler);

            handler = new NullableSByteTypeHandler();
            Register(typeof(SByte?), handler);

            handler = new NullableTimeSpanTypeHandler();
            Register(typeof(TimeSpan?), handler);

            unknownTypeHandler = new UnknownTypeHandler(this);

		}