private IEdmNavigationProperty ParseSingleConstraint(string property, string referencedProperty, CsdlLocation location = null) { var constraint = new CsdlReferentialConstraint(property, referencedProperty, null, location); var testSubject = new CsdlSemanticsNavigationProperty(this.semanticEntityType, new CsdlNavigationProperty("Fake", "Fake.Fake", false, "Fake", false, null, new[] { constraint }, null, null)); return testSubject; }
private EdmReferentialConstraintPropertyPair ComputeReferentialConstraintPropertyPair(CsdlReferentialConstraint csdlConstraint) { // <EntityType Name="Product"> // ... // <Property Name="CategoryID" Type="Edm.String" Nullable="false"/> // <NavigationProperty Name="Category" Type="Self.Category" Nullable="false"> // <ReferentialConstraint Property="CategoryID" ReferencedProperty="ID" /> // </NavigationProperty> // </EntityType> // the above CategoryID is DependentProperty, ID is PrincipalProperty. IEdmStructuralProperty dependentProperty = this.declaringType.FindProperty(csdlConstraint.PropertyName) as IEdmStructuralProperty ?? new UnresolvedProperty(this.declaringType, csdlConstraint.PropertyName, csdlConstraint.Location); IEdmStructuralProperty principalProperty = this.TargetEntityType.FindProperty(csdlConstraint.ReferencedPropertyName) as IEdmStructuralProperty ?? new UnresolvedProperty(this.ToEntityType(), csdlConstraint.ReferencedPropertyName, csdlConstraint.Location); return new EdmReferentialConstraintPropertyPair(dependentProperty, principalProperty); }