private void ConfigureInverse(EdmAssociationType associationType, EdmModel model) { //Contract.Requires(associationType != null); //Contract.Requires(model != null); if (_inverseNavigationProperty == null) { return; } var inverseNavigationProperty = model.GetNavigationProperty(_inverseNavigationProperty); if ((inverseNavigationProperty != null) && (inverseNavigationProperty.Association != associationType)) { associationType.SourceEnd.EndKind = inverseNavigationProperty.Association.TargetEnd.EndKind; if ((associationType.Constraint == null) && (_constraint == null) && (inverseNavigationProperty.Association.Constraint != null)) { associationType.Constraint = inverseNavigationProperty.Association.Constraint; associationType.Constraint.DependentEnd = associationType.Constraint.DependentEnd.EntityType == associationType.SourceEnd.EntityType ? associationType.SourceEnd : associationType.TargetEnd; } model.RemoveAssociationType(inverseNavigationProperty.Association); inverseNavigationProperty.Association = associationType; inverseNavigationProperty.ResultEnd = associationType.SourceEnd; } }