public static void GetAssociationAnnotations(this IEdmModel model, IEdmNavigationProperty property, out IEnumerable <IEdmDirectValueAnnotation> annotations, out IEnumerable <IEdmDirectValueAnnotation> end1Annotations, out IEnumerable <IEdmDirectValueAnnotation> end2Annotations, out IEnumerable <IEdmDirectValueAnnotation> constraintAnnotations) { annotations = null; end1Annotations = null; end2Annotations = null; constraintAnnotations = null; EdmUtil.CheckArgumentNull <IEdmModel>(model, "model"); EdmUtil.CheckArgumentNull <IEdmNavigationProperty>(property, "property"); property.PopulateCaches(); SerializationExtensionMethods.AssociationAnnotations annotationValue = model.GetAnnotationValue <SerializationExtensionMethods.AssociationAnnotations>(property, "http://schemas.microsoft.com/ado/2011/04/edm/internal", "AssociationAnnotations"); if (annotationValue == null) { IEnumerable <IEdmDirectValueAnnotation> edmDirectValueAnnotations = Enumerable.Empty <IEdmDirectValueAnnotation>(); annotations = edmDirectValueAnnotations; end1Annotations = edmDirectValueAnnotations; end2Annotations = edmDirectValueAnnotations; constraintAnnotations = edmDirectValueAnnotations; return; } else { IEnumerable <IEdmDirectValueAnnotation> enumerablePointers = annotations; IEnumerable <IEdmDirectValueAnnotation> edmDirectValueAnnotations1 = annotationValue.Annotations; IEnumerable <IEdmDirectValueAnnotation> edmDirectValueAnnotations2 = edmDirectValueAnnotations1; if (edmDirectValueAnnotations1 == null) { edmDirectValueAnnotations2 = Enumerable.Empty <IEdmDirectValueAnnotation>(); } (enumerablePointers) = edmDirectValueAnnotations2; IEnumerable <IEdmDirectValueAnnotation> enumerablePointers1 = end1Annotations; IEnumerable <IEdmDirectValueAnnotation> edmDirectValueAnnotations3 = annotationValue.End1Annotations; IEnumerable <IEdmDirectValueAnnotation> edmDirectValueAnnotations4 = edmDirectValueAnnotations3; if (edmDirectValueAnnotations3 == null) { edmDirectValueAnnotations4 = Enumerable.Empty <IEdmDirectValueAnnotation>(); } (enumerablePointers1) = edmDirectValueAnnotations4; IEnumerable <IEdmDirectValueAnnotation> enumerablePointers2 = end2Annotations; IEnumerable <IEdmDirectValueAnnotation> edmDirectValueAnnotations5 = annotationValue.End2Annotations; IEnumerable <IEdmDirectValueAnnotation> edmDirectValueAnnotations6 = edmDirectValueAnnotations5; if (edmDirectValueAnnotations5 == null) { edmDirectValueAnnotations6 = Enumerable.Empty <IEdmDirectValueAnnotation>(); } (enumerablePointers2) = edmDirectValueAnnotations6; IEnumerable <IEdmDirectValueAnnotation> enumerablePointers3 = constraintAnnotations; IEnumerable <IEdmDirectValueAnnotation> edmDirectValueAnnotations7 = annotationValue.ConstraintAnnotations; IEnumerable <IEdmDirectValueAnnotation> edmDirectValueAnnotations8 = edmDirectValueAnnotations7; if (edmDirectValueAnnotations7 == null) { edmDirectValueAnnotations8 = Enumerable.Empty <IEdmDirectValueAnnotation>(); } (enumerablePointers3) = edmDirectValueAnnotations8; return; } }
public static void SetAssociationAnnotations(this IEdmModel model, IEdmNavigationProperty property, IEnumerable <IEdmDirectValueAnnotation> annotations, IEnumerable <IEdmDirectValueAnnotation> end1Annotations, IEnumerable <IEdmDirectValueAnnotation> end2Annotations, IEnumerable <IEdmDirectValueAnnotation> constraintAnnotations) { EdmUtil.CheckArgumentNull <IEdmModel>(model, "model"); EdmUtil.CheckArgumentNull <IEdmNavigationProperty>(property, "property"); if (annotations != null && annotations.FirstOrDefault <IEdmDirectValueAnnotation>() != null || end1Annotations != null && end1Annotations.FirstOrDefault <IEdmDirectValueAnnotation>() != null || end2Annotations != null && end2Annotations.FirstOrDefault <IEdmDirectValueAnnotation>() != null || constraintAnnotations != null && constraintAnnotations.FirstOrDefault <IEdmDirectValueAnnotation>() != null) { SerializationExtensionMethods.AssociationAnnotations associationAnnotation = new SerializationExtensionMethods.AssociationAnnotations(); associationAnnotation.Annotations = annotations; associationAnnotation.End1Annotations = end1Annotations; associationAnnotation.End2Annotations = end2Annotations; associationAnnotation.ConstraintAnnotations = constraintAnnotations; model.SetAnnotationValue(property, "http://schemas.microsoft.com/ado/2011/04/edm/internal", "AssociationAnnotations", associationAnnotation); } }
public static void SetAssociationAnnotations(this IEdmModel model, IEdmNavigationProperty property, IEnumerable<IEdmDirectValueAnnotation> annotations, IEnumerable<IEdmDirectValueAnnotation> end1Annotations, IEnumerable<IEdmDirectValueAnnotation> end2Annotations, IEnumerable<IEdmDirectValueAnnotation> constraintAnnotations) { EdmUtil.CheckArgumentNull<IEdmModel>(model, "model"); EdmUtil.CheckArgumentNull<IEdmNavigationProperty>(property, "property"); if (annotations != null && annotations.FirstOrDefault<IEdmDirectValueAnnotation>() != null || end1Annotations != null && end1Annotations.FirstOrDefault<IEdmDirectValueAnnotation>() != null || end2Annotations != null && end2Annotations.FirstOrDefault<IEdmDirectValueAnnotation>() != null || constraintAnnotations != null && constraintAnnotations.FirstOrDefault<IEdmDirectValueAnnotation>() != null) { SerializationExtensionMethods.AssociationAnnotations associationAnnotation = new SerializationExtensionMethods.AssociationAnnotations(); associationAnnotation.Annotations = annotations; associationAnnotation.End1Annotations = end1Annotations; associationAnnotation.End2Annotations = end2Annotations; associationAnnotation.ConstraintAnnotations = constraintAnnotations; model.SetAnnotationValue(property, "http://schemas.microsoft.com/ado/2011/04/edm/internal", "AssociationAnnotations", associationAnnotation); } }