1 / 8

Association Simplification

Association Simplification. Issues with Associations. Defining Associations (and association sets) in order to represent links is cumbersome Associations are bi-directional Difficult to do Composition Want to model root as a single entity. Associations Today. < EntityType Name = " Genre " >

gamada
Download Presentation

Association Simplification

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Association Simplification

  2. Issues with Associations • Defining Associations (and association sets) in order to represent links is cumbersome • Associations are bi-directional • Difficult to do Composition • Want to model root as a single entity

  3. Associations Today <EntityTypeName="Genre"> <Key> <PropertyRefName="Name"/> </Key> <PropertyName="Name"Nullable="false"Type="Edm.String"/> <NavigationPropertyName="Titles"Relationship="Netflix.Catalog.v2.Genre_Titles" ToRole="Genre_Titles_Target"FromRole="Genre_Titles_Source" /> </EntityType> <EntityTypeName="Film"> <Key> <PropertyRefName="Name"/> </Key> <PropertyName="Name"Nullable="false"Type="Edm.String"/> <NavigationPropertyName="Genre"Relationship="Netflix.Catalog.v2.Genre_Titles" ToRole="Genre_Titles_Source"FromRole="Genre_Titles_Target" /> </EntityType> <AssociationName="Genre_Titles"> <EndType="Netflix.Catalog.v2.Genre"Multiplicity="1"Role="Genre_Titles_Source"/> <EndType="Netflix.Catalog.v2.Title"Multiplicity="*"Role="Genre_Titles_Target"/> </Association> <EntityContainerName="NetflixCatalog"> <EntitySetName="Genres"EntityType="Netflix.Catalog.v2.Genre"/> <EntitySetName="Titles"EntityType="Netflix.Catalog.v2.Film"/> <AssociationSetName="Title_Discs"Association="Netflix.Catalog.v2.Title_Discs"> <EndRole="Title_Discs_Source"EntitySet="Titles"/> <EndRole="Title_Discs_Target"EntitySet="Genres"/> </AssociationSet> </EntityContainer>

  4. How Associations Could Look <EntityTypeName="Genre"> <Key> <PropertyRefName="Name"/> </Key> <PropertyName="Name"Nullable="false"Type="Edm.String"/> <NavigationPropertyName="Titles"Type="Collection(Netflix.Catalog.V2.Title)" Partner="Genre"/> </EntityType> <EntityTypeName="Film"> <Key> <PropertyRefName="Name"/> </Key> <PropertyName="Name"Nullable="false"Type="Edm.String"/> <NavigationPropertyName="Genre"Type"Netflix.Catalog.v2.Genre"nullable="false" Partner="Titles"/> </EntityType> <EntityContainerName="NetflixCatalog"> <EntitySetName="Genres"EntityType="Netflix.Catalog.v2.Genre"> <NavigationPropertyBindingPath="Titles"EntitySet="Titles"/> </EntitySet> <EntitySetName="Titles"EntityType="Netflix.Catalog.v2.Film"> <NavigationPropertyBindingPath="Genre"EntitySet="Genres"/> </EntitySet> </EntityContainer>

  5. Root Entity • Often you have a single root element, with properties, with relationships to other EntitySets • Model as a "Named Entity" rooted at the entity container: <EntityContainerName="Sales"> <EntityName="Consoto"Type="Enterprise.Company" /> </EntityContainer>

  6. Changes • Support specifying Type, Nullability, Partner in Navigation Property • Partner may be optional • Specify NavigationPropertyBinding in EntitySet • Binding may be optional • Addition of "Top Level Entity" • Supports root entity

  7. Benefits • Simpler to read • Information is localized where you expect to find it • Enables one-way relationships • Makes it easier to support Composition • Doesn't change OData semantics, behavior, etc.

  8. Discussion • Instead of root element make the EntityContainer an entity type

More Related