Description
This solution is a sample (so use at your own risk...) that:
- implements an IDataServiceActionProvider for WCF Data Services 5.0 (for OData 3.0) over the Entity Framework
- includes a separate website with an OData service that exposes a model with actions, using the sample IDataServiceActionProvider.
How to use
- See Part 1 to see the experience enabled by this provider.
- See Part 2 for a description of IDataServiceActionProvider which is implemented by this sample
- See Part 3 for an explanation of this code.
How to try it out
- Get everything compiling and then debug the web-application.
- Hit http://localhost:{port}/MoviesService.svc/Movies(1) with a browser
- Notice the URLs for actions
- Copy one of the action urls, suggestion try the for the Rate action
- i.e. http://localhost:{port}/MoviesService.svc/Movies(1)/Rate
- Put a break point on the Rate(Movie m, int rating) method in your MoviesModel class
- Use a tool like Fiddler to send this request to the service:
POST http://localhost:{port}/MoviesService.svc/Movies(1)/Rate HTTP/1.1
Content-Type: application/json;odata-verbose
{
"rating": 5
}
- Step through the action when the break point is hit.
- Try adding your own actions!
Prerequisites
- .NET 4.0 or higher
- VS 2010 sp1 or higher (sp1 is needed for IIS Express integration)
- ASP.NET MVC 3.0 or higher
- IIS Express 7.5 or higher
- WCF Data Service 5.0
- Nuget
- other dependencies should be resolved by nuget at build time.