I have an OData project that was created from a web API template (including credentials).
I have a class ApplicationUser: IdentityUser.
I have a TournamentContext: IdentityDbContext class.
I have a default AccountController that comes with a template with the [RoutePrefix ("api / Account")] attribute.
In WebApiConfig.cs For the default web template for the api template, I have
config.Routes.MapHttpRoute(
name: "DefaultApi",
routeTemplate: "api/{controller}/{id}",
defaults: new {id = RouteParameter.Optional});
To support OData, I added:
config.Routes.MapODataRoute("odata", "odata", GetModel(),
new DefaultODataBatchHandler(GlobalConfiguration.DefaultServer));
and
private static IEdmModel GetModel()
{
ODataConventionModelBuilder builder = new ODataConventionModelBuilder();
builder.EntitySet<Tournament>("Tournaments");
return builder.GetEdmModel();
}
Now, I want to expose account / user management through the OData API. How do I achieve this?
Thanks, Yaniv Ratson.
source
share