public UIAssociation AddAssociation(string associationName, string navigationProperty1Name, UIEntityType navigationProperty1EntityType, Cardinality navigationProperty1Cardinality, string navigationProperty2Name, UIEntityType navigationProperty2EntityType, Cardinality navigationProperty2Cardinality) { var association = CSDL.AddAssociation(associationName, navigationProperty1Name, navigationProperty1EntityType.BusinessInstance, navigationProperty1Cardinality, navigationProperty2Name, navigationProperty2EntityType.BusinessInstance, navigationProperty2Cardinality); return(new UIAssociation { NavigationProperty1 = navigationProperty1EntityType.Properties[association.PropertyEnd1] as UIRelatedProperty, NavigationProperty2 = navigationProperty2EntityType.Properties[association.PropertyEnd2] as UIRelatedProperty }); }