Quantcast
Channel: ASP.NET MVC / Web API / Web Pages
Viewing all articles
Browse latest Browse all 7925

New Post: Web API, OData and layered architecture

$
0
0

Our application architecture contains the following layers:

  • Presentation Layer
  • Service Layer
  • Business Layer
  • Data Layer

The Service layer uses WebAPI to expose RESTful services.  When retrieving data we would like to standardize on some syntax for paging.  OData seems like a great place to start.  The service layer utilizes the business layer to retrieve data. The business layer, in turn utilizes the data layer which is built on the Entity Framework.  The data layer passes a list of entity objects back to the business layer.  The business layer then converts the list of entity objects to a list of DTOs for public consumption.  

Adding OData to our service appears to manipulate the IQueryable set of DTOs with one major performance issue.  The OData operations are performed on the list of DTOs.  If we pass in something like the following:

api/codes?$orderby=ID&$top=5&$skip=0

The data layer retrieves all 100,000 codes, passes them to the business layer which in turn converts them to a list of DTOs.  OData then applies the "paging".  It works, but it's slow.

It would be nice if there was a way to pass the ODataQueryOptions down to the data layer so the database would filter the list.  Is this something in the works?  I believe our system design implements many of Microsoft's best practices for system architecture.  This must be an issue for other developers out there?

I have installed Web API OData 0.3.0-rc.

Thanks.


Viewing all articles
Browse latest Browse all 7925

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>