本文整理汇总了C#中IEdmTypeReference.AsStructuredOrNull方法的典型用法代码示例。如果您正苦于以下问题:C# IEdmTypeReference.AsStructuredOrNull方法的具体用法?C# IEdmTypeReference.AsStructuredOrNull怎么用?C# IEdmTypeReference.AsStructuredOrNull使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IEdmTypeReference
的用法示例。
在下文中一共展示了IEdmTypeReference.AsStructuredOrNull方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BindProperty
/// <summary>
/// Given a property name, if the associated type reference is strucutred, then this returns
/// the property of the structured type. Otherwise, it returns null.
/// </summary>
/// <param name="parentReference">The parent type to be used to find binding options.</param>
/// <param name="propertyName">The string designated the property name to be bound.</param>
/// <param name="resolver">Resolver for uri parser.</param>
/// <returns>The property associated with string and parent type.</returns>
internal static IEdmProperty BindProperty(IEdmTypeReference parentReference, string propertyName, ODataUriResolver resolver = null)
{
if (resolver == null)
{
resolver = ODataUriResolver.Default;
}
IEdmStructuredTypeReference structuredParentType =
parentReference == null ? null : parentReference.AsStructuredOrNull();
return structuredParentType == null ? null : resolver.ResolveProperty(structuredParentType.StructuredDefinition(), propertyName);
}
示例2: BindProperty
/// <summary>
/// Binds a string to its associated type.
/// </summary>
/// <param name="parentReference">The parent type to be used to find binding options.</param>
/// <param name="propertyName">The string designated the property name to be bound.</param>
/// <returns>The property associated with string and parent type.</returns>
private static IEdmProperty BindProperty(IEdmTypeReference parentReference, string propertyName)
{
IEdmStructuredTypeReference structuredParentType =
parentReference == null ? null : parentReference.AsStructuredOrNull();
return structuredParentType == null ? null : structuredParentType.FindProperty(propertyName);
}
示例3: SetEpmValue
/// <summary>
/// Sets the value read from EPM to a property on an entry.
/// </summary>
/// <param name="targetList">The target list, which is a list of properties (on entry or complex value).</param>
/// <param name="targetTypeReference">The type of the value on which to set the property (can be entity or complex).</param>
/// <param name="epmInfo">The EPM info for the mapping for which the value was read.</param>
/// <param name="propertyValue">The property value read, if the value was specified as null then this should be null,
/// if the value was missing the method should not be called at all.
/// For primitive properties this should be the string value, for all other properties this should be the exact value type.</param>
protected void SetEpmValue(
IList targetList,
IEdmTypeReference targetTypeReference,
EntityPropertyMappingInfo epmInfo,
object propertyValue)
{
Debug.Assert(epmInfo != null, "epmInfo != null");
Debug.Assert(targetTypeReference != null, "targetTypeReference != null");
Debug.Assert(targetList != null, "targetList != null");
Debug.Assert(
targetTypeReference.IsODataEntityTypeKind() || targetTypeReference.IsODataComplexTypeKind(),
"Only entity and complex types can have an EPM value set on them.");
this.SetEpmValueForSegment(
epmInfo,
0,
targetTypeReference.AsStructuredOrNull(),
(List<ODataProperty>)targetList,
propertyValue);
}
示例4: SetEpmValue
protected void SetEpmValue(IList targetList, IEdmTypeReference targetTypeReference, EntityPropertyMappingInfo epmInfo, object propertyValue)
{
this.SetEpmValueForSegment(epmInfo, 0, targetTypeReference.AsStructuredOrNull(), (List<ODataProperty>) targetList, propertyValue);
}