本文整理汇总了C#中MappingAction.MapToIdlStruct方法的典型用法代码示例。如果您正苦于以下问题:C# MappingAction.MapToIdlStruct方法的具体用法?C# MappingAction.MapToIdlStruct怎么用?C# MappingAction.MapToIdlStruct使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MappingAction
的用法示例。
在下文中一共展示了MappingAction.MapToIdlStruct方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MapClsTypeWithTransform
//.........这里部分代码省略.........
mapType = MapType.Interface;
} else if (IsMarshalByRef(clsType)) {
mapType = MapType.MarshalByRef;
} else if (IsMappablePrimitiveType(clsType)) {
mapType = MapType.Primitive;
} else if (IsEnum(clsType)) {
if (HasEnumFlagsAttributes(clsType)) {
mapType = MapType.Flags;
} else {
// enums with more than Int32.MaxValue elements can't be mapped to idl.
// but not possibly to check this, because in .NET 1.0, no support for Array.LongLength.
mapType = MapType.Enum;
}
} else if (IsArray(clsType)) {
mapType = MapType.Array;
} else if (clsType.IsSubclassOf(ReflectionHelper.BoxedValueBaseType)) {
// a boxed value type, which needs not to be boxed/unboxed but should be handled like a normal value type
mapType = MapType.BoxedValue2;
} else if (clsType.IsSubclassOf(s_exceptType) || clsType.Equals(s_exceptType)) {
mapType = MapType.Exception;
} else if (IsMarshalledAsStruct(clsType)) {
mapType = MapType.Struct;
} else if (IsMarshalledAsUnion(clsType)) {
mapType = MapType.Union;
} else if (clsType.Equals(ReflectionHelper.ObjectType)) {
mapType = MapType.Object;
} else if (clsType.Equals(s_anyType)) {
mapType = MapType.Any;
} else if (clsType.Equals(ReflectionHelper.TypeType) || clsType.IsSubclassOf(ReflectionHelper.TypeType)) {
mapType = MapType.TypeDesc;
} else if (clsType.Equals(s_corbaTypeCodeImplType) || clsType.IsSubclassOf(s_corbaTypeCodeImplType) ||
clsType.Equals(ReflectionHelper.CorbaTypeCodeType)) {
mapType = MapType.TypeCode;
} else if (!UnmappableType(clsType)) {
if (IsValueTypeConcrete(clsType)) {
mapType = MapType.ConcreteValue;
} else {
// other types are mapped to an abstract value type
mapType = MapType.AbstractValue;
}
} else {
// not mappable: clsType
mapType = MapType.Unmappable;
}
lock(mapTypes)
mapTypes[key] = mapType;
}
switch(mapType)
{
case MapType.BoxedValueNotFound:
Trace.WriteLine("boxed type not found for boxed value attribute");
throw new NO_IMPLEMENT(10001, CompletionStatus.Completed_MayBe);
case MapType.BoxedValue:
Type boxed = GetBoxedValueType((BoxedValueAttribute)boxedValAttr);
Type needsBoxingFrom = clsType;
clsType = boxed; // transformation
return action.MapToIdlBoxedValueType(boxed, needsBoxingFrom);
case MapType.Interface:
return CallActionForDNInterface(ref clsType, action);
case MapType.MarshalByRef:
return action.MapToIdlConcreteInterface(clsType);
case MapType.Primitive:
return CallActionForDNPrimitveType(ref clsType, ref attributes, action);
case MapType.Flags:
return action.MapToIdlFlagsEquivalent(clsType);
case MapType.Enum:
// enums with more than Int32.MaxValue elements can't be mapped to idl.
// but not possibly to check this, because in .NET 1.0, no support for Array.LongLength.
return action.MapToIdlEnum(clsType);
case MapType.Array:
return CallActionForDNArray(ref clsType, ref attributes, originalAttributes, action);
case MapType.BoxedValue2:
// a boxed value type, which needs not to be boxed/unboxed but should be handled like a normal value type
return action.MapToIdlBoxedValueType(clsType, null);
case MapType.Exception:
return action.MapException(clsType);
case MapType.Struct:
return action.MapToIdlStruct(clsType);
case MapType.Union:
return action.MapToIdlUnion(clsType);
case MapType.Object:
return CallActionForDNObject(ref clsType, ref attributes, action);
case MapType.Any:
return action.MapToIdlAny(clsType);
case MapType.TypeDesc:
return action.MapToTypeDesc(clsType);
case MapType.TypeCode:
return action.MapToTypeCode(clsType);
case MapType.ConcreteValue:
return action.MapToIdlConcreateValueType(clsType);
case MapType.AbstractValue:
// other types are mapped to an abstract value type
return action.MapToIdlAbstractValueType(clsType);
}
// not mappable: clsType
throw new BAD_PARAM(18800, CompletionStatus.Completed_MayBe, "The type " + clsType.AssemblyQualifiedName +
" is not mappable to idl");
}