For example, I want to change the navigation property link by providing my own link builder code:<br /><br />public class Todo<br />{<br />public int Id { get; set; }<br />public Person CreatedBy { get; set; }<br />}<br />public class Person<br />{<br />public int PersonID { get; set; }<br />public string Name { get; set; }<br />}<br /><br />var builder = new ODataConventionModelBuilder();<br />var todoes = builder.EntitySet<Todo>("Todo");<br />todoes.HasNavigationPropertiesLink(<br />todoes.EntityType.NavigationProperties,<br />(entityContext, navigationProperty) => new Uri(entityContext.UrlHelper.Link(ODataRouteNames.PropertyNavigation, new { Controller = "Todo", parentId = entityContext.EntityInstance.Id, NavigationProperty = navigationProperty.Name })));<br />return builder.GetEdmModel();<br /><br />The code reports following error:<br /><br />System.InvalidOperationException occurred<br /> HResult=-2146233079<br /> Message=No NavigationLink factory was found for the property 'CreatedBy' on entity set 'Todo'. Try calling HasNavigationPropertyLink on the EntitySetConfiguration.<br /> Source=System.Web.Http.OData<br /> StackTrace:<br /> at System.Web.Http.OData.Builder.EntitySetLinkBuilderAnnotation.BuildNavigationLink(EntityInstanceContext context, IEdmNavigationProperty navigationProperty) in C:\dd\DevDiv\Offcycle\WPT\WebStackRuntime\runtime\src\System.Web.Http.OData\OData\Builder\EntitySetLinkBuilderAnnotation.cs:line 121<br /> InnerException: <br />
Comments: http://aspnetwebstack.codeplex.com/SourceControl/changeset/cbe82217ed89
Comments: http://aspnetwebstack.codeplex.com/SourceControl/changeset/cbe82217ed89