public CsdlSemanticsNavigationPropertyTests() { var constraints = new[] { new CsdlReferentialConstraint("FK", "ID", null, null) }; this.collectionProperty = new CsdlNavigationProperty("Collection", "Collection(FQ.NS.EntityType)", null, "Reference", false, null, constraints, null, null); this.referenceProperty = new CsdlNavigationProperty("Reference", "FQ.NS.EntityType", false, null, false, null, Enumerable.Empty<CsdlReferentialConstraint>(), null, null); var navigationWithoutPartner = new CsdlNavigationProperty("WithoutPartner", "FQ.NS.EntityType", false, null, false, null, Enumerable.Empty<CsdlReferentialConstraint>(), null, null); var idProperty = new CsdlProperty("ID", new CsdlNamedTypeReference("Edm.Int32", false, null), false, null, null, null); var fkProperty = new CsdlProperty("FK", new CsdlNamedTypeReference("Edm.Int32", false, null), false, null, null, null); this.csdlEntityType = new CsdlEntityType("EntityType", null, false, false, false, new CsdlKey(new[] { new CsdlPropertyReference("ID", null) }, null), new[] { idProperty, fkProperty }, new[] { collectionProperty, referenceProperty, navigationWithoutPartner }, null, null); var csdlSchema = new CsdlSchema("FQ.NS", null, null, new[] { this.csdlEntityType }, Enumerable.Empty<CsdlEnumType>(), Enumerable.Empty<CsdlOperation>(),Enumerable.Empty<CsdlTerm>(),Enumerable.Empty<CsdlEntityContainer>(),Enumerable.Empty<CsdlAnnotations>(), Enumerable.Empty<CsdlTypeDefinition>(), null, null); var csdlModel = new CsdlModel(); csdlModel.AddSchema(csdlSchema); var semanticModel = new CsdlSemanticsModel(csdlModel, new EdmDirectValueAnnotationsManager(), Enumerable.Empty<IEdmModel>()); this.semanticEntityType = semanticModel.FindType("FQ.NS.EntityType") as CsdlSemanticsEntityTypeDefinition; this.semanticEntityType.Should().NotBeNull(); this.semanticCollectionNavigation = this.semanticEntityType.FindProperty("Collection") as CsdlSemanticsNavigationProperty; this.semanticReferenceNavigation = this.semanticEntityType.FindProperty("Reference") as CsdlSemanticsNavigationProperty; this.semanticNavigationWithoutPartner = this.semanticEntityType.FindProperty("WithoutPartner") as CsdlSemanticsNavigationProperty; this.semanticCollectionNavigation.Should().NotBeNull(); this.semanticReferenceNavigation.Should().NotBeNull(); this.semanticNavigationWithoutPartner.Should().NotBeNull(); }
internal static CsdlEntityType EntityType( string name, string baseName = null, bool isAbstract = false, bool isOpen = false, bool hasStream = false, CsdlKey csdlKey = null, CsdlProperty[] properties = default(CsdlProperty[]), CsdlNavigationProperty[] navProps = default(CsdlNavigationProperty[]), CsdlDocumentation documentation = null, CsdlLocation location = null) { if (properties == null) { properties = new CsdlProperty[] { }; } if (navProps == null) { navProps = new CsdlNavigationProperty[] { }; } return new CsdlEntityType( name, baseName, isAbstract, isOpen, hasStream, csdlKey, properties, navProps, documentation, location); }
public CsdlSemanticsProperty(CsdlSemanticsStructuredTypeDefinition declaringType, CsdlProperty property) : base(property) { this.property = property; this.declaringType = declaringType; }