Access to DAL data with ASP.Net MVC Identity and Owin

Asked

Viewed 322 times

2

Today my solution has a MVC 5 Web application project and a DAL Library (Data Access Layer) with EF Databasefirst.

I want to create a layer with MVC Identity + Owin, however I would like the data access to be done in DAL.

How do I do this? Have a good example of how to separate access to data from MVC Identity and Owin?

  • 1

    Are you sure you want to do this? Look, I’ll even answer, but I don’t recommend you go down this path.

1 answer

1


First, ASP.NET Identity and OWIN are not "separable". OWIN is a standard interface, and ASP.NET Identity is an implementation that deals with users in your application. ASP.NET Identity may or may not follow OWIN, because it works with it, but it can use another pattern as well, no problem.

Second, to reimplement the behavior of ASP.NET Identity, you will need to reimplement the following classes:

Once this is done, your system can work with ASP.NET Identity at the DAL level.

The problem is that by putting an extra layer you will be creating a complicator, since the application is implemented using an agnostic model of data access with dynamic binding to libraries like the Entity Framework.

  • Hello Gypsy. I’m sorry if I wasn’t clear, but I don’t intend to separate Identity from Owin. I just want to centralize data access in the data access layer. It wouldn’t be good practice?

  • 1

    The problem is that by putting an extra layer you are creating a complicator, since the application is implemented using an agnostic model of data access with dynamic binding to libraries like the Entity Framework.

  • Because I was working with a data access layer separate from my main application and Identity already comes with some of its own access patterns, I suspected that I was actually creating a complicator, but nothing better than listening to other opinions. Vlw.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.