I have a Web Api using Odata v3, with some entities a composite key, like this one:
public class AerodromoAdministracaoData
{
[Key]
[Column("idAerodromo", Order = 0)]
[DatabaseGenerated(DatabaseGeneratedOption.None)]
public short IdAerodromo { get; set; }
[Key]
[Column("data", Order = 1, TypeName = "date")]
public DateTime Data { get; set; }
public virtual Aerodromo Aerodromo { get; set; }
}
I followed this msdn article and created a NavigationRoutingConvention. The application handles composite keys fine now. However, navigation Links like this one don't work:
http://localhost/WebApiV3/AerodromoAdministracaoData%28idAerodromo=1,data=%272014-10-24%27%29/Aerodromo
I keep getting a "No HTTP resource was found that matches the request" as if the method was not implemented in the controller. By the way, this is the controller method:
[EnableQuery]
public Aerodromo GetAerodromo([FromODataUri] short idAerodromo, [FromODataUri] DateTime data)
{
AerodromoAdministracaoData result = Store.AerodromoAdministracaoData.Find(idAerodromo, data);
if (result == null)
{
throw new HttpResponseException(new System.Net.Http.HttpResponseMessage(System.Net.HttpStatusCode.NotFound));
}
return result.Aerodromo;
}
I found this question talking about exactly the same problem, but I haven't figured out how Nikon handled the issue.