XPO - Web API and OData V4 Support

XPO Team Blog
05 July 2018

Want to expose your eXpress Persistent Objects™ (XPO) data model for CRUD operations through a lightweight JSON web service?

Our new Code Example implements a fully-functional OData V4 service with XPO and Web API. This solution relies on the Microsoft.AspNet.OData library, and is an alternative to our WCF-based XPO Data Service.  For the .NET Core-based example, refer to How to Implement OData v4 Service with XPO (.NET Core).

Why is an OData Service ever needed?

Interoperability: As you may already know, XPO is a powerful ORM library for .NET. It provides a unified way to manage data for multiple database engines (14 supported databases). Even if your app is not for targeting the .NET Framework, it is still possible to take advantage of XPO's features. That is because clients for popular platforms (Windows, iOS, Android, Web, etc. can consume OData services. For more information on OData benefits, visit http://www.odata.org/

Why drop the previous XPO Data Service (OData V3)?

  • Functionality: OData V4 supports more features than OData V3: What’s New in OData Version 4.0.
  • Maintenance: According to Microsoft documentation, all REST feature enchancements will be made for ASP.NET Web API.
  • Flexibility: Web API Controllers are extension points, wherein you can add custom logic to manage/validate objects or customize a LINQ query.
  • Compatibility: Since the OASIC committee accepted OData V4, it has become a worldwide standard. Many developers use OData V4 and your service will be compatible with their applications.

Like it?

We created this example based on requests received from users. We hope to refine it with community feedback. For instance, this boilerplate code can be automated using the wizard. Drop us a line below once you've had an opportunity to test this feature, thanks.

See Also

XPO ORM Library – Available Free-of-Charge in v18.1!

Love XPO and want to help us promote it? Add the package through Nuget.org instead of DevExpress Nuget!




 

  Uriah
  DevExpress Support
  XPO team

14 comment(s)
YYannekk
YYannekk

Quite nice I like it!

It seems it should also be possible to run XPO with the recently released Microsoft.AspNetCore.OData (www.nuget.org/.../Microsoft.AspNetCore.OData) package, so running on dotnet core seems doable or will there be obvious obstacles?

5 July 2018
Manuel Grundner [DevExpress MVP]
Manuel Grundner [DevExpress MVP]

Awesome! :) That what i wanted for almost 7 years :) have to Update my Blog in this

5 July 2018
Andrey Makhorin
Andrey Makhorin

Great! It's time to refactoring old solutions...

6 July 2018
Thomas Vetterling
Thomas Vetterling

Good news for targetting crossplattform devices with an 'xpo'-Based OData Service.

Now we dont have to handle more than one 'model' of buisnessobjects.

Good job !!

6 July 2018
Yekaterina K (DevExpress)
Yekaterina K (DevExpress)

@YYannekk: Microsoft.AspNetCore.OData can have some specificities, so it is possible that some modifications will be required to use our example with this library. We did not yet research this and cannot answer your question. If you want to try it yourself, we would greatly appreciate your feedback. 

@Manuel: I'm happy to hear that this feature is so helpful for you. Looking forward to your new blog post! 

@Andrey, Thomas: Thank you for your feedback. You can count on our assistance if you face any difficulties.

6 July 2018
Santiago Moscoso
Santiago Moscoso

Can we use Domain Components from a XAF application?

10 July 2018
Debeściak
Debeściak

could you modify example to run as selfhosted without IIS ?

31 January 2019
Dennis (DevExpress)
Dennis (DevExpress)

@Santiago Moscoso:

We have not researched DC use in this scenario. It is likely they will require additional adjustments as in www.devexpress.com/.../Q480762 and others.

@Debeściak:

We do not have a ready example - we will take your request into account for the future.

Unless I am mistaken, the greatest part of this task is to get Web API 2 working without XPO first. This is a general programming task that is covered in Microsoft documentation and other public community resources, for instance: docs.microsoft.com/.../use-owin-to-self-host-web-api. Once you implement this part, the XPO-related integration should work automatically.

Please keep us informed of your progress in this regard.

31 January 2019
Marco Kummer
Marco Kummer

Has anyone had success using this OData example on .NET Core? @YYannekk ?

6 May 2019
Dennis (DevExpress)
Dennis (DevExpress)

@Marco Kummer:

We made a spike for XPO OData v4 service with .NET Core: github.com/.../XpoODataServiceCore. We would welcome your feedback before we update our official documentation. Thanks in advance.

23 May 2019
Phan Sin Tian
Phan Sin Tian
I try to run in VS 2017 in IIS development mode but I get no result in browser. and  no database is being created as well in SQL
10 September 2019
Dennis (DevExpress)
Dennis (DevExpress)
@Phan Sin Tian: Thank you for your feedback. We'll answer you in the Support Center: https://www.devexpress.com/Support/Center/Question/Details/T813979/xpo-odata-v4-service-does-not-create-the-database.
11 September 2019
Daz
Daz
Why are your demos and samples never commented. It makes it so difficult to learn new things when I don't know why you are doing certain things.
6 January 2020
Uriah (DevExpress Support)
Uriah (DevExpress Support)
@Daz:

You can find detailed aspects in README.md. Feel free to ask further questions in our Support Center.

Please note that this example is based on the ASP.NET Web API framework. You may want to explore Create an OData v4 Endpoint Using ASP.NET Web API and other Microsoft documentation articles first.

9 January 2020

Please login or register to post comments.