1

I have an existing web forms project which consists of 3 different projects: UI layer (Web project), Business Logic Layer and Database Project. I have already written the data access methods which connect to the database and return data to the business logic layer.

Now we need to provide a REST API, and I was thinking of using oData API along with REST. But all the examples I have seen use Entity Framework and I just cannot use Entity Framework because our data access layer returns data to the business layer, which then processes that data and adds some logic, and then present it to the UI layer.

Can I still use oData API? If yes, then will I need to create fresh methods manually for each of the complex query of oData API? How will OData API access my BL Layer?

1 Answer 1

2

You can do this (I have just done similar myself) but it is very hard work.

To me, OData always felt like a way of exposing the entity framework through web services so if you were to try and implement it without the entity framework you will end up spending a lot of time parsing queries to your data access layer.

If you do decide to go down this route, maybe consider only implementing part of the OData spec - work out which parts you actually want to be able to use - as it is huge and the task is daunting.

These are only from my experiences though and you may have a better data access layer API setup than I had when I started which could make things significantly easier.

EDIT to answer last question:

Will you need to create fresh methods manually for each of the complex query of oData API? This will really depend on how your data will be exposed and how your data access layer is setup.

Sign up to request clarification or add additional context in comments.

3 Comments

Thanks Tom, but then why so much buzz around OData when it forces you to use Entity Framework? When I can’t use my DAL Layer code, then OData is useless for me, which somehow doesn’t make sense considering the hype around it.
The hype is because it gives you A LOT as a consumer. It doesn't force you to use Entity Framework but with Entity Framework it is really really easy. I have successfully implemented quite a lot of OData without Entity Framework but it isn't easy. This is really just a warning to say, make sure that you really do want to use OData and that it really will provide you with benefits before you start!
Hi guys! Currently I'm facing a similar problem like yours, I have a BFF (OData) that consumes a bunch of APIs also based on OData (using ODataClients). We need to remove OData from APIs and keep it in the BFF side but we cannot miss some functionality like Expand, Select , etc... So I was wondering there is a way to create an ODataContext based on a bunch of APIs instead of Data Base? Thanks!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.