本文整理汇总了C#中MappingAction.MapToIdlConcreteInterface方法的典型用法代码示例。如果您正苦于以下问题:C# MappingAction.MapToIdlConcreteInterface方法的具体用法?C# MappingAction.MapToIdlConcreteInterface怎么用?C# MappingAction.MapToIdlConcreteInterface使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MappingAction
的用法示例。
在下文中一共展示了MappingAction.MapToIdlConcreteInterface方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CallActionForDNInterface
/// <summary>determines the mapping for the case, where clsType is a CLS-interface</summary>
private object CallActionForDNInterface(ref Type clsType, MappingAction action) {
// distinguish the different cases here
object[] attrs = clsType.GetCustomAttributes(s_interfaceTypeAttrType, true);
if (attrs.Length > 1) {
// only one InterfaceTypeAttribute for an interface allowed
throw new INTERNAL(18811, CompletionStatus.Completed_MayBe);
}
InterfaceTypeAttribute interfaceAttr = null;
if (attrs.Length > 0) {
interfaceAttr = (InterfaceTypeAttribute) attrs[0];
}
if ((interfaceAttr == null) || (interfaceAttr.IdlType.Equals(IdlTypeInterface.AbstractInterface))) {
return action.MapToIdlAbstractInterface(clsType);
} else if (interfaceAttr.IdlType.Equals(IdlTypeInterface.ConcreteInterface)) {
return action.MapToIdlConcreteInterface(clsType);
} else if (interfaceAttr.IdlType.Equals(IdlTypeInterface.AbstractValueType)) {
return action.MapToIdlAbstractValueType(clsType);
} else if (interfaceAttr.IdlType.Equals(IdlTypeInterface.LocalInterface)) {
return action.MapToIdlLocalInterface(clsType);
} else {
// ttributte IntrerfaceTypeAttribute had an unknown value for IDLType: interfaceAttr.IdlType
throw new MARSHAL(18809, CompletionStatus.Completed_MayBe);
}
}
示例2: 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");
}