SharePoint, Office 365, Azure, and Front end JS geek. – Chicago IL
SharePoint, Office 365, Azure, and Front end JS geek. – Chicago IL

WebAPI OData – 10 min video introduction (Visual Studio 2013)

I’ve been learning about OData and wanted to record a quick getting started video with how to create a new WebAPI project, add OData Controller, and send HTTP CRUD operations.  Below is an example using Adventure Works Departments with sample code, screenshots, and a 10 minute video introduction.   Please leave a comment if you found this helpful.  Thanks! 

shades_smile

Video Content

  • Create MVC 4 web application
  • SQL Express – Adventure Works Departments
  • Add “AdventureWorks.edmx
    • Wizard driven
    • F4 set namespace
  • Add “DepartmentsController.cs
    • Create from EDMX class
    • Implements ODataController
    • Replace ID with KEY
  • Edit “WebApiConfig.cs
    • Comment out default route
    • Add OData route builder
  • Test with HTTP manually
  • Test with Chrome REST Postman
  • SQL Express – see changed data

Watch Video

WebAPI OData – 10 min video introduction (Visual Studio 2013) from Jeff Jones on Vimeo.

Sample Code

[WebApiConfig.cs]

 

[DepartmentsController.cs]

Downloads

Screenshots

image
image
image
image
image
  • Pav

    Hi Jeff,
    i have followed your walk through to the letter, but I am experiencing an issue with accessing the entity.

    I can see the localhost:12345/odata and localhost:12345/odata/$metadata pages, but the localhost:12345/MYEntity results in displaying “Server Error in ‘/’ Application” error.

    I am a complete newbie, so it is quite possible i have missed out some basic prerequisites. Could you think of something obvious from top of your head or point me to some resources?

    Kind regards

    • Pav

      sorry, just noticed that the sentence should have been:
      but the localhost:12345/odata/MYEntity results in displaying “Server Error in ‘/’ Application” error.

© Copyright 2016
@ SPJeff

Return to Top ▲Return to Top ▲