Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OData with EF Core / ASP.NET Core - Good or Bad?

I've read a lot about OData with EF Core / ASP.NET Core. It seems to me that everybody has an opinion on this and It's gotten a bit confusing, so at the risk of sounding dumb, I have a few questions:

Please note:
! I'm NOT talking about the classic ASP.NET 4.6 or 4.7 with EF6 !
! I'm talking about ASP.NET Core with EF Core !

  1. Considering building API - Is there stuff that EF Core alone couldn't handle as well as EF Core with OData?

  2. Considering building API - Is it not better to build clean RESTful APIs instead of OData style APIs?

  3. Isn't implementing OData stuff sacrificing best practices for convenience?

  4. What about long term? Aren't ASP.NET Core + EF Core being built with speed and efficiency in mind and thus won't they be faster and more efficient on their own?

like image 907
PaxForce Avatar asked Jun 29 '17 07:06

PaxForce


People also ask

Should I use EF6 or EF core?

Keep using EF6 if the data access code is stable and not likely to evolve or need new features. Port to EF Core if the data access code is evolving or if the app needs new features only available in EF Core. Porting to EF Core is also often done for performance.

What is OData ASP NET core?

OData uses the Entity Data Model (EDM) to describe the structure of data. In ASP.NET Core OData, it's easy to build the EDM based on the above CLR types (Entity, Complex, Enum). With that in mind, let's add the following private static method at the end of Startup.

Is Dapper better than Entity Framework Core?

Dapper is literally much faster than Entity Framework Core considering the fact that there are no bells and whistles in Dapper. It is a straight forward Micro ORM that has minimal features as well. It is always up to the developer to choose between these 2 Awesome Data Access Technologies.

Can I use EF in .NET core?

There's currently no support for using the EF designer directly on . NET Core or . NET Standard projects.


2 Answers

I will go with Shawn Wildermuth's advice that I found on Pluralsight:

OData means that queries are on the client so that versioning OData services becomes risky and it feels like MS is moving away from it so I don't have confidence in the long-term viability of it either.

like image 200
PaxForce Avatar answered Nov 02 '22 00:11

PaxForce


OData on ASP.NET Core/EF Core works very well. Versioning can be accomplished with microsofts versioning api. I don't necessarily see MS abandoning this technology. There main api (ms graph) is odata 4 compatible.

Using Odata on top of EF Core is really enjoyable for many use cases. Especially the querying part I like a lot. For implementing writes/commands I usually fall back to webapi/Mediatr.

Here https://www.jannikbuschke.de/blog/cqrs-with-mediatr-and-odata/ and here https://www.jannikbuschke.de/blog/odata-getting-started/ I wrote some thoughts/guides on this topic.

One downside is tooling and community. There is not a whole lot out there.

like image 39
jannikb Avatar answered Nov 02 '22 02:11

jannikb