I am testing building an OData feed with ASP.NET WebAPI in Visual Studio 2013. I am using the following versions:
* .NET 4.5
* Entity Framework 6.0.2-beta1
* ODataLib 5.6.0
I am getting the following error with a database that has table PKs with up to 6 columns. The EDMX (database first) gets build now since the following bug has been resolved:
https://entityframework.codeplex.com/workitem/1735
When I create my controllers for the entity classes and received the runtime error:
The complex type 'BaseballStatsOData.Models.Team' refers to the entity type 'BaseballStatsOData.Models.Batting' through the property 'Batting'
I think that the original error may still be around and I am still digging into the code but wanted to get this up ASAP.
I posted an error to the EF Codeplex project and received feedback from the EF as to where they think the bug is in the ODataConventionModelBuilder class.
https://entityframework.codeplex.com/workitem/1875
I have attachments for the db schema
Comments: Hi, The ODataConventionModelBuilder is not intended to infer composite keys, so that's why it's thinking it's a complex type instead of an entity. In this case you can simply do builder.Entity<Team>() to tell the convention model builder explicitly that it is an entity.
* .NET 4.5
* Entity Framework 6.0.2-beta1
* ODataLib 5.6.0
I am getting the following error with a database that has table PKs with up to 6 columns. The EDMX (database first) gets build now since the following bug has been resolved:
https://entityframework.codeplex.com/workitem/1735
When I create my controllers for the entity classes and received the runtime error:
The complex type 'BaseballStatsOData.Models.Team' refers to the entity type 'BaseballStatsOData.Models.Batting' through the property 'Batting'
I think that the original error may still be around and I am still digging into the code but wanted to get this up ASAP.
I posted an error to the EF Codeplex project and received feedback from the EF as to where they think the bug is in the ODataConventionModelBuilder class.
https://entityframework.codeplex.com/workitem/1875
I have attachments for the db schema
Comments: Hi, The ODataConventionModelBuilder is not intended to infer composite keys, so that's why it's thinking it's a complex type instead of an entity. In this case you can simply do builder.Entity<Team>() to tell the convention model builder explicitly that it is an entity.