本文整理汇总了C#中System.Data.Services.Providers.ResourceType.TryResolveNamedStream方法的典型用法代码示例。如果您正苦于以下问题:C# ResourceType.TryResolveNamedStream方法的具体用法?C# ResourceType.TryResolveNamedStream怎么用?C# ResourceType.TryResolveNamedStream使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Data.Services.Providers.ResourceType
的用法示例。
在下文中一共展示了ResourceType.TryResolveNamedStream方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetPropertyType
/// <summary>
/// Returns a resource type of the property on the specified resource type.
/// </summary>
/// <param name="resourceType">The resource type to look for the property on.</param>
/// <param name="propertyName">The name of the property to look for.</param>
/// <param name="isMultiValueProperty">return true if the property was a MultiValue property.</param>
/// <returns>The type of the property specified. Note that for MultiValue properties this returns the type of the item of the MultiValue property.</returns>
private static ResourceType GetPropertyType(ResourceType resourceType, string propertyName, out bool isMultiValueProperty)
{
Debug.Assert(propertyName != null, "propertyName != null");
isMultiValueProperty = false;
ResourceProperty resourceProperty = resourceType != null ? resourceType.TryResolvePropertyName(propertyName) : null;
if (resourceProperty != null)
{
if (resourceProperty.IsOfKind(ResourcePropertyKind.MultiValue))
{
isMultiValueProperty = true;
Debug.Assert(resourceProperty.ResourceType is MultiValueResourceType, "MultiValue property must be of the MultiValueResourceType.");
MultiValueResourceType multiValueResourceType = (MultiValueResourceType)resourceProperty.ResourceType;
return multiValueResourceType.ItemType;
}
else
{
return resourceProperty.ResourceType;
}
}
else
{
if (resourceType != null && !resourceType.IsOpenType)
{
// could be a named stream
resourceProperty = resourceType.TryResolveNamedStream(propertyName);
if (resourceProperty != null)
{
throw new ODataException(Strings.EpmSourceTree_NamedStreamCannotBeMapped(propertyName, resourceType.FullName));
}
else
{
throw new ODataException(Strings.EpmSourceTree_MissingPropertyOnType(propertyName, resourceType.FullName));
}
}
return null;
}
}