Exemplo n.º 1
0
            /// <summary>
            /// Gets the <see cref="IEdmExpression"/> of an annotation targeting a specified property or navigation property of an <paramref name="edmType"/>.
            /// </summary>
            /// <param name="edmModel">The edm model.</param>
            /// <param name="edmType">The specified edm type.</param>
            /// <param name="propertyName">The name of the specified property or navigation property.</param>
            /// <param name="termName">The term name.</param>
            /// <param name="qualifier">Qualifier to apply</param>
            /// <returns>The <see cref=" IEdmExpression"/> of the annotation, or null if it is not found.</returns>
            internal IEdmExpression GetAnnnotationExpressionForProperty(IEdmModel edmModel, IEdmType edmType, string propertyName, string termName, string qualifier)
            {
                if (termName != null)
                {
                    var clientTypeAnnotation = edmModel.GetClientTypeAnnotation(edmType);
                    if (clientTypeAnnotation != null)
                    {
                        var propertyInfo = ClientTypeUtil.GetClientPropertyInfo(clientTypeAnnotation.ElementType, propertyName, this.dataServiceContext.UndeclaredPropertyBehavior);
                        if (propertyInfo != null)
                        {
                            var annotation = GetOrInsertCachedMetadataAnnotationForPropertyInfo(this.dataServiceContext, propertyInfo, termName, qualifier);
                            if (annotation != null)
                            {
                                return(annotation.Value);
                            }
                        }
                    }
                }

                return(null);
            }
Exemplo n.º 2
0
 /// <summary>
 /// Gets client property info of a specified property name from a Type.
 /// </summary>
 /// <param name="type">The type that contains the property.</param>
 /// <param name="propertyName">The name of the property.</param>
 /// <param name="propertyInfo">The specified property, or null if the property is not found</param>
 /// <returns>True if the property is found, else false.</returns>
 internal bool TryGetClientPropertyInfo(Type type, string propertyName, out PropertyInfo propertyInfo)
 {
     propertyInfo = ClientTypeUtil.GetClientPropertyInfo(type, propertyName, this.dataServiceContext.UndeclaredPropertyBehavior);
     return(propertyInfo != null);
 }
Exemplo n.º 3
0
 /// <summary>
 /// Gets client property info of a specified property name from a Type.
 /// </summary>
 /// <param name="type">The type that contains the property.</param>
 /// <param name="propertyName">The name of the property.</param>
 /// <param name="propertyInfo">The specified property, or null if the property is not found</param>
 /// <returns>True if the property is found, else false.</returns>
 internal bool TryGetClientPropertyInfo(Type type, string propertyName, out PropertyInfo propertyInfo)
 {
     propertyInfo = ClientTypeUtil.GetClientPropertyInfo(type, propertyName, this.dataServiceContext.IgnoreMissingProperties);
     return(propertyInfo != null);
 }