/// <summary> /// Gets the property info for the EDM property on the specified type. /// </summary> /// <param name="typeReference">The type to get the property on.</param> /// <param name="property">Property instance to get the property info for.</param> /// <param name="model">Model containing annotations.</param> /// <returns>Returns the PropertyInfo object for the specified property.</returns> /// <remarks>The method searches this type as well as all its base types for the property.</remarks> internal static PropertyInfo GetPropertyInfo(this IEdmStructuredTypeReference typeReference, IEdmProperty property, IEdmModel model) { DebugUtils.CheckNoExternalCallers(); Debug.Assert(typeReference != null, "typeReference != null"); Debug.Assert(property != null, "property != null"); Debug.Assert(model != null, "model != null"); Debug.Assert(property.GetCanReflectOnInstanceTypeProperty(model), "property.CanReflectOnInstanceTypeProperty()"); #if DEBUG Debug.Assert(typeReference.ContainsProperty(property), "The typeReference does not define the specified property."); #endif IEdmStructuredType structuredType = typeReference.StructuredDefinition(); return(PropertyInfoTypeAnnotation.GetPropertyInfoTypeAnnotation(structuredType, model).GetPropertyInfo(structuredType, property, model)); }
/// <summary> /// Gets the property info annotation for the specified type or creates a new one if it doesn't exist. /// </summary> /// <param name="structuredType">The type to get the annotation for.</param> /// <param name="model">The model containing annotations.</param> /// <returns>The property info annotation.</returns> internal static PropertyInfoTypeAnnotation GetPropertyInfoTypeAnnotation(IEdmStructuredType structuredType, IEdmModel model) { DebugUtils.CheckNoExternalCallers(); Debug.Assert(structuredType != null, "structuredType != null"); Debug.Assert(model != null, "model != null"); PropertyInfoTypeAnnotation propertyInfoTypeAnnotation = model.GetAnnotationValue<PropertyInfoTypeAnnotation>(structuredType); if (propertyInfoTypeAnnotation == null) { propertyInfoTypeAnnotation = new PropertyInfoTypeAnnotation(); model.SetAnnotationValue(structuredType, propertyInfoTypeAnnotation); } return propertyInfoTypeAnnotation; }
/// <summary> /// Gets the property info annotation for the specified type or creates a new one if it doesn't exist. /// </summary> /// <param name="structuredType">The type to get the annotation for.</param> /// <param name="model">The model containing annotations.</param> /// <returns>The property info annotation.</returns> internal static PropertyInfoTypeAnnotation GetPropertyInfoTypeAnnotation(IEdmStructuredType structuredType, IEdmModel model) { DebugUtils.CheckNoExternalCallers(); Debug.Assert(structuredType != null, "structuredType != null"); Debug.Assert(model != null, "model != null"); PropertyInfoTypeAnnotation propertyInfoTypeAnnotation = model.GetAnnotationValue <PropertyInfoTypeAnnotation>(structuredType); if (propertyInfoTypeAnnotation == null) { propertyInfoTypeAnnotation = new PropertyInfoTypeAnnotation(); model.SetAnnotationValue(structuredType, propertyInfoTypeAnnotation); } return(propertyInfoTypeAnnotation); }