简体   繁体   中英

Is OData suitable for a big MVC5/WebAPI application

I was working with the following stack MVC5 + WebAPI 2.2 + EF6 + AngularJS for my web application. Today, I tried to incorporate OData and Angular BreezeJS into my application and it worked fine for one of the entities.

Currently, I have around 45 tables which translate to 45 model classes.

In Web API, I could have just have 5-10 controllers to handle the CRUD operations for the 45 models using a switch statement based on the variables I pass like entityName , operationName .

But, in OData I need 45 controllers scaffold-ed by VS. Is there any way I can use the benefits of OData such as querying/paging/patching without having to create a controller for each model class ?

Do you work with Entity Framework ? If so, you can try with RESTier. RESTier is built upon Web API OData , and it need only ONE controller to make all the basic CRUD (including queries) work.

You can learn more from the tutorial http://odata.github.io/RESTier/Getting-Started-Part-1/ and a sample with Northwind locates at https://github.com/OData/RESTier/tree/master/src/Microsoft.Restier.Samples.Northwind .

I have done this for an admin system for an ecommerce company. Probably about 20 tables and related api controllers, some of the tables have 10,000's record and all controllers have the odata bits enabled. It seems fine for me so far on Azure SQL and websites. I am using a controller per model/entity, why are you against doing that?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM