I am using https://www.nuget.org/packages/Microsoft.AspNetCore.OData/7.3.0 to expose OData 4 based Querable API using ASP.NET Core 3.1 API
I have EF Data context with keyless entity(Database view), When I try to expose it with OData Convention based model
modelBuilder
.Entity<Student>(eb =>
{
eb.HasNoKey();
eb.ToView("vw_students", "public");
});
And here is my OData EDM Model mapping with EF Core entity type
var edmBuilder = new ODataConventionModelBuilder();
edmBuilder.EntitySet<Student>("Students");
return edmBuilder.GetEdmModel();
I get an error on this line edmBuilder.GetEdmModel() The entity set 'Students' is based on type 'ODataCore31.Student' that has no keys defined.
My questions- 1) Are Keyless entity types are natively supported by OData model? 2) Is there any workaround?