本文整理汇总了C#中IEdmPrimitiveTypeReference.PrimitiveDefinition方法的典型用法代码示例。如果您正苦于以下问题:C# IEdmPrimitiveTypeReference.PrimitiveDefinition方法的具体用法?C# IEdmPrimitiveTypeReference.PrimitiveDefinition怎么用?C# IEdmPrimitiveTypeReference.PrimitiveDefinition使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IEdmPrimitiveTypeReference
的用法示例。
在下文中一共展示了IEdmPrimitiveTypeReference.PrimitiveDefinition方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: EnsurePrimitiveType
/// <summary>
/// Ensures a primitive type reference for a given primitive type kind.
/// </summary>
/// <param name="type">The possibly null type reference.</param>
/// <param name="primitiveKindFromValue">The primitive type kind to ensure.</param>
/// <returns>An <see cref="IEdmPrimitiveTypeReference"/> instance created for the <paramref name="primitiveKindFromValue"/>
/// if <paramref name="type"/> is null; if <paramref name="type"/> is not null, validates it and then returns it.</returns>
private static IEdmPrimitiveTypeReference EnsurePrimitiveType(IEdmPrimitiveTypeReference type, EdmPrimitiveTypeKind primitiveKindFromValue)
{
if (type == null)
{
type = EdmCoreModel.Instance.GetPrimitive(primitiveKindFromValue, /*isNullable*/ true);
}
else
{
EdmPrimitiveTypeKind primitiveKindFromType = type.PrimitiveDefinition().PrimitiveKind;
if (primitiveKindFromType != primitiveKindFromValue)
{
string typeName = type.FullName();
if (typeName == null)
{
throw new ODataException(ErrorStrings.EdmValueUtils_IncorrectPrimitiveTypeKindNoTypeName(primitiveKindFromType.ToString(), primitiveKindFromValue.ToString()));
}
throw new ODataException(ErrorStrings.EdmValueUtils_IncorrectPrimitiveTypeKind(typeName, primitiveKindFromValue.ToString(), primitiveKindFromType.ToString()));
}
}
return type;
}
示例2: GetPrimitiveClrType
/// <summary>
/// Returns the primitive CLR type for the specified primitive type reference.
/// </summary>
/// <param name="primitiveTypeReference">The primitive type to resolve.</param>
/// <returns>The CLR type for the primitive type reference.</returns>
internal static Type GetPrimitiveClrType(IEdmPrimitiveTypeReference primitiveTypeReference)
{
DebugUtils.CheckNoExternalCallers();
Debug.Assert(primitiveTypeReference != null, "primitiveTypeReference != null");
return GetPrimitiveClrType(primitiveTypeReference.PrimitiveDefinition(), primitiveTypeReference.IsNullable);
}
示例3: GetPrimitiveClrType
internal static Type GetPrimitiveClrType(IEdmPrimitiveTypeReference primitiveTypeReference)
{
return GetPrimitiveClrType(primitiveTypeReference.PrimitiveDefinition(), primitiveTypeReference.IsNullable);
}