none
Add ASP.NET Identity (User Management) to OData via Web API 2 RRS feed

  • General discussion

  • I have an OData project that was created from Web API template (including credentials).

    I have an ApplicationUser:IdentityUser class.

    I have a TournamentContext : IdentityDbContext class.

    I have the default AccountController that comes with the template with [RoutePrefix("api/Account")] attribute.

    In WebApiConfig.cs For the web api template default routing I have

    config.Routes.MapHttpRoute(
                name: "DefaultApi",
                routeTemplate: "api/{controller}/{id}",
                defaults: new {id = RouteParameter.Optional});

    For the OData support I've 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 the account/user management via the OData API. How do I achieve that?

    Thanks,

    Janiv Ratson.


    Janiv Ratson. Technology and Development Expert. | BL: http://blogs.microsoft.co.il/blogs/janiv/ | LI: http://www.linkedin.com/in/janiv | TW: http://twitter.com/janiv http://about.me/janiv

    Tuesday, February 4, 2014 9:29 PM

All replies

  • You may want to post the question on http://forums.asp.net/1246.aspx/1?Web+API since the issue is related to Web API.
    Wednesday, February 5, 2014 5:43 PM
  • Hello and thank you for moving my question to the appropriate forum.

    Would you help me with this topic?

    Thanks,

    Janiv.


    Janiv Ratson. Technology and Development Expert. | BL: http://blogs.microsoft.co.il/blogs/janiv/ | LI: http://www.linkedin.com/in/janiv | TW: http://twitter.com/janiv http://about.me/janiv

    Wednesday, February 12, 2014 7:28 AM