public static bool _Invoke_System_ComponentModel_Design_Serialization_InstanceDescriptor( )
        {
            //class object
            System.ComponentModel.Design.Serialization.InstanceDescriptor _System_ComponentModel_Design_Serialization_InstanceDescriptor = new System.ComponentModel.Design.Serialization.InstanceDescriptor();

            //Parameters

            //ReturnType/Value
            System.Object returnVal_Real        = null;
            System.Object returnVal_Intercepted = null;

            //Exception
            System.Exception exception_Real        = null;
            System.Exception exception_Intercepted = null;

            InterceptionMaintenance.disableInterception( );

            try
            {
                returnVal_Real = _System_ComponentModel_Design_Serialization_InstanceDescriptor.Invoke();
            }

            catch (System.Exception e)
            {
                exception_Real = e;
            }


            InterceptionMaintenance.enableInterception( );

            try
            {
                returnVal_Intercepted = _System_ComponentModel_Design_Serialization_InstanceDescriptor.Invoke();
            }

            catch (System.Exception e)
            {
                exception_Intercepted = e;
            }


            return((exception_Real.Messsage == exception_Intercepted.Message) && (returnValue_Real == returnValue_Intercepted));
        }
        public static bool _Invoke_System_ComponentModel_Design_Serialization_InstanceDescriptor( )
        {
            //class object
            System.ComponentModel.Design.Serialization.InstanceDescriptor _System_ComponentModel_Design_Serialization_InstanceDescriptor = new System.ComponentModel.Design.Serialization.InstanceDescriptor();

               //Parameters

               //ReturnType/Value
               System.Object returnVal_Real = null;
               System.Object returnVal_Intercepted = null;

               //Exception
               System.Exception exception_Real = null;
               System.Exception exception_Intercepted = null;

               InterceptionMaintenance.disableInterception( );

               try
               {
              returnVal_Real = _System_ComponentModel_Design_Serialization_InstanceDescriptor.Invoke();
               }

               catch( System.Exception e )
               {
              exception_Real = e;
               }

               InterceptionMaintenance.enableInterception( );

               try
               {
              returnVal_Intercepted = _System_ComponentModel_Design_Serialization_InstanceDescriptor.Invoke();
               }

               catch( System.Exception e )
               {
              exception_Intercepted = e;
               }

               return( ( exception_Real.Messsage == exception_Intercepted.Message ) && ( returnValue_Real == returnValue_Intercepted ) );
        }
コード例 #3
0
ファイル: param.cs プロジェクト: JordanChin/Ingres
	}  // CanConvert

	public override object ConvertTo(
		ITypeDescriptorContext context,
		CultureInfo culture,
		object value,
		Type destinationType)
	{
		if (destinationType != typeof(
			System.ComponentModel.Design.Serialization.InstanceDescriptor)
			||  !(value is IngresParameter))
			return base.ConvertTo (context, culture, value, destinationType);

		IngresParameter parm = (IngresParameter)value;
		string          parameterName = parm.ParameterName;// != null ?
		//	parm.ParameterName : "";

		System.Reflection.ConstructorInfo ctorInfo = null;
		Object[] values;

		const int NOTHING_SPECIFIED      = 0x00;
		const int INGRESTYPE_SPECIFIED   = 0x01;
		const int VALUE_SPECIFIED        = 0x02;
		const int SOURCECOLUMN_SPECIFIED = 0x04;
		const int SIZE_SPECIFIED         = 0x08;
		const int OTHER_SPECIFIED        = 0x10;
		const int INGRESTYPE_AND_SOURCECOLUMN_SPECIFIED =
		             INGRESTYPE_SPECIFIED |
		             SOURCECOLUMN_SPECIFIED;
		const int INGRESTYPE_AND_SIZE_SPECIFIED =
		             INGRESTYPE_SPECIFIED |
		             SIZE_SPECIFIED;
		const int INGRESTYPE_AND_SIZE_AND_SOURCECOLUMN_SPECIFIED =
		             INGRESTYPE_SPECIFIED |
		             SIZE_SPECIFIED       |
		             SOURCECOLUMN_SPECIFIED;

		int       specified              = NOTHING_SPECIFIED;

		if (parm.ProviderType != ProviderType.NVarChar)
			specified |= INGRESTYPE_SPECIFIED;

		if (parm.Size != 0)
			specified |= SIZE_SPECIFIED;

		if (parm.Direction != ParameterDirection.Input)
			specified |= OTHER_SPECIFIED;

		if (parm.IsNullable != false)
			specified |= OTHER_SPECIFIED;

		if (parm.Precision != 0)
			specified |= OTHER_SPECIFIED;

		if (parm.Scale != 0)
			specified |= OTHER_SPECIFIED;

		if (parm.SourceVersion != DataRowVersion.Current)
			specified |= OTHER_SPECIFIED;

		if (parm.SourceColumn != null   &&
			parm.SourceColumn.Length != 0)
			specified |= SOURCECOLUMN_SPECIFIED;

		if (parm.Value != null)
			specified |= VALUE_SPECIFIED;

		switch( specified )
		{
			case NOTHING_SPECIFIED:
			case INGRESTYPE_SPECIFIED:
			{
				ctorInfo = typeof(IngresParameter).GetConstructor( new Type[]
				{
					typeof(String),
					typeof(IngresType)
				});
				values = new Object[2];
				values[0] = parameterName;
				values[1] = parm.IngresType;
				break;
			}

			case VALUE_SPECIFIED:
			{
				ctorInfo = typeof(IngresParameter).GetConstructor( new Type[]
				{
					typeof(String),
					typeof(object)
				});
				values = new Object[2];
				values[0] = parameterName;
				values[1] = parm.Value;
				break;
			}

			case INGRESTYPE_AND_SOURCECOLUMN_SPECIFIED:
			case SOURCECOLUMN_SPECIFIED:
			{
				ctorInfo = typeof(IngresParameter).GetConstructor( new Type[]
				{
					typeof(String),
					typeof(IngresType),
					typeof(String)
				});
				values = new Object[3];
				values[0] = parameterName;
				values[1] = parm.IngresType;
				values[2] = parm.SourceColumn;
				break;
			}

			case INGRESTYPE_AND_SIZE_SPECIFIED:
			case SIZE_SPECIFIED:
			{
				ctorInfo = typeof(IngresParameter).GetConstructor( new Type[]
				{
					typeof(String),
					typeof(IngresType),
					typeof(int)
				});
				values = new Object[3];
				values[0] = parameterName;
				values[1] = parm.IngresType;
				values[2] = parm.Size;
				break;
			}

			case INGRESTYPE_AND_SIZE_AND_SOURCECOLUMN_SPECIFIED:
			{
				ctorInfo = typeof(IngresParameter).GetConstructor( new Type[]
				{
					typeof(String),
					typeof(IngresType),
					typeof(int),
					typeof(String)
				});
				values = new Object[4];
				values[0] = parameterName;
				values[1] = parm.IngresType;
				values[2] = parm.Size;
				values[3] = parm.SourceColumn;
				break;
			}

			default:
			{
				ctorInfo = typeof(IngresParameter).GetConstructor( new Type[]
				{
					typeof(String),
					typeof(IngresType),
					typeof(int),
					typeof(ParameterDirection),
					typeof(bool),
					typeof(byte),
					typeof(byte),
					typeof(String),
					typeof(DataRowVersion),
					typeof(object)
				});

				values = new Object[10];
				values[0] = parameterName;
				values[1] = parm.IngresType;
				values[2] = parm.Size;
				values[3] = parm.Direction;
				values[4] = parm.IsNullable;
				values[5] = parm.Precision;
				values[6] = parm.Scale;
				values[7] = parm.SourceColumn;
				values[8] = parm.SourceVersion;
				values[9] = parm.Value;
				break;
			}
		}

		System.ComponentModel.Design.Serialization.InstanceDescriptor
			instanceDescriptor = new
			System.ComponentModel.Design.Serialization.InstanceDescriptor(
			ctorInfo, values);
		// return the InstanceDescriptor so that the VS Parameter
		// Collection Editor can generate the constructor source code.
		return instanceDescriptor;
	}  // ConvertTo