Search code examples
c#entity-frameworkasp.net-web-apiasp.net-identity-23-tier

3 tier application with Identity and EF


I am developing a 3-tier project with authentication from scratch. I am using the following as a guide for implementing Identity authentication: http://bitoftech.net/2015/01/21/asp-net-identity-2-with-asp-net-web-api-2-accounts-management/

The issue is that I am required to install the following NuGet packages:

Install-Package Microsoft.AspNet.Identity.Owin -Version 2.1.0
Install-Package Microsoft.AspNet.Identity.EntityFramework -Version 2.1.0
Install-Package Microsoft.Owin.Host.SystemWeb -Version 3.0.0
Install-Package Microsoft.AspNet.WebApi.Owin -Version 5.2.2
Install-Package Microsoft.Owin.Security.OAuth -Version 3.0.0
Install-Package Microsoft.Owin.Cors -Version 3.0.0

I intuitively installed Microsoft.AspNet.Identity.Owin into my Presentation Layer and now the dilemma, Microsoft.AspNet.Identity.EntityFramework where does it go? I already installed EF6 into the Data Access Layer, is there a way to provide this dependency to Microsoft.AspNet.Identity.EntityFramework in the Presentation Layer?


Solution

  • It should go into your web project.

    Microsoft.AspNet.Identity.EntityFramework is a namespace that provides classes to easily hookup an identity project to Entity Framework. It doesn't actually provide anything for EF itself.

    If you chose to use a different ORM or if you wanted to fully customize asp.net identity (say, make your own UserStore), you wouldn't even include that package in your project.