What is the relationship between the EF6 model and the WebAPI 2.2 + OData 4.0 model?

It's been a couple of years since I worked with EF and OData. At that time, OData on WebAPI was limited to some URL filters, but even that was pulled at the last minute before RTM MVC 4.

A lot has changed.

Now I have a project of the first EF6 model with an EDMX file, since I like to visually plan my model. I am also creating an OData service for this application using WebAPI 2.2 and OData 4.0.

Please comment below:

"Unfortunately, the EDM model used by EF is currently different from the EDM model used by the OData Web API."

OData exception The type of the complex "WebTools.Order" refers to the type of the object "WebTools.Customer" through the property "Client"

Clearly, sharing is best for public APIs.

However, I am confused because the tutorials on how to get started quickly on the Internet (see below) seem to use the same EF code model for OData and the database.

Does this mean that the models no longer differ from each other, the comment above is old? Or does that mean I have to go into code first if I just want to expose my database model?

And since the textbooks seem to demonstrate one model of the EF database, so how do you separate and have two models?

I find it hard to find / trust online resources because these technologies are so fast.

Luke

+4
1

.

  • OData v4 EDMX .

  • "" , POCO, , v4 node ', , .

  • , .

  • , OData sql .

  • , SQL EF, IQueryable, .

  • OData v4 POCO, .

  • OData v4 EF, , greenfield , , v4 v4, .

  • POCO . EDMX SQL, "" POCO . , , , .

. 2015 Excel, LinqPad v4. , , - "" . v4 , WCF Data Services EDMX .

1/

:

http://msdn.microsoft.com/en-us/library/jj200620.aspx

2/

EF-, , [NotMapped] modelBuilder.Ignore<InMemClass>();, API.

+3

Source: https://habr.com/ru/post/1570189/


All Articles