/// <summary> /// Adds Associations to the EDM model based on an Entity Data Model Schema /// </summary> /// <param name="model">EDM model to append to</param> /// <param name="model">Entity Data Model Schema to get associations from</param> private static void AddNavigationProperties(ConstructableMetadata model, IEdmEntityType entityType, IEnumerable<NavigationProperty> properties) { foreach (NavigationProperty property in properties) { if (property.ToEndMember.RelationshipMultiplicity == RelationshipMultiplicity.Many) { model.AddResourceSetReferenceProperty( entityType, property.Name, model.FindEntitySet(property.ToEndMember.GetEntityType().Name), model.FindType(property.ToEndMember.GetEntityType().FullName) as IEdmEntityType ); } else { model.AddResourceReferenceProperty( entityType, property.Name, model.FindEntitySet(property.ToEndMember.GetEntityType().Name), model.FindType(property.ToEndMember.GetEntityType().FullName) as IEdmEntityType ); } } }