B
B
bashtanka942014-11-29 22:36:13
ASP.NET
bashtanka94, 2014-11-29 22:36:13

How to put ASP.NET Identity in data layer?

You need to create an ASP .NET MVC 5 application with a three-tier architecture.
I decided to use the native authorization, only there were difficulties with the fact that the user needs to be associated with the entities of the subject area, and the authorization should be transferred to the data layer ...
Googling this topic, I came to the conclusion that it is possible to create an inherited class from IdentityUser, but then what about dbContext ? because the context must be inherited from two classes, which is not possible ...

//AccountablePerson.cs
 public class AccountablePerson:IdentityUser
    {
        public string Name { get; set; }
        public string Surname { get; set; }
        public string Middle { get; set; }

        public virtual IEnumerable<Payment> Payments { get; set; }
    }


//Payment
namespace SheetFlow.DAL.Entity
{
    public class Payment
    {
      public int ID{get;set}
       public string Name { get; set; }
       public UInt32 Sum { get; set; }
       public DateTime Date { get; set; }

       public virtual PaymentType Type { get; set; }

       public virtual Good Good { get; set; }

       public virtual AccountablePerson Person { get; set; }

      
    }

Please tell me how to solve the problem?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
W
wkololo_4ever, 2014-11-29
@wkololo_4ever

Not absolutely understood - what for you are going to be inherited from two classes?
IndentityUser - the entity of the user. (tablet in database)
dbContext - database context.
Here is an example of the implementation of the architecture you need https://github.com/MarlabsInc/SocialGoal/tree/mast...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question