Quantcast
Channel: ASPNETWebStack Issue Tracker Rss Feed
Viewing all articles
Browse latest Browse all 7215

Created Unassigned: Provide support for referential constraints in the ModelBuilder and when using AssociationLinkAttribute [1684]

$
0
0
This workitem tracks the remaining work of https://aspnetwebstack.codeplex.com/workitem/1423 as the changes in the model builder required to support referential constraints and AssociationLinkAttribute are out of scope of the bug.

Basically we currently build the model in the following way:

We build the type headers.
We build the properties (navigation and structural at the same time)

In order to support adding referential constraints we should build the model the following way:

Build the type headers.
Build the structural properties for all types.
Build the navigation properties for all types.

It will require extending the default ODataModelBuilder to allow specifying principal and dependent properties of the relationship, and a convention on the ODataConventionModelBuilder to support AssociationAttribute, for example

```
public class Customer
{
public int Id { get; set; }
public ICollection<Order> { get; set;}
}

public class Order
{
public int Id { get; set; }
public int CustomerId { get; set; }
[Association(IsForeignKey=true, ThisKey="CustomerId", OtherKey="Id")]
public Customer { get; set; }
}
```

Would result in a navigation property being created for the given entity that specifies the referential constraint in the $metadata

Viewing all articles
Browse latest Browse all 7215

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>