admin管理员组

文章数量:1186701

I'm writing a simple app to manage the relationship between some entities:

  1. An application administrator
  2. The business admin (running a film-making company)
  3. The director of the film

There are other entities like film, agreement (between company and director) etc. as well, but I'm not going to name them one by one.

Because my question goes like this:

following an agreement, the business admin (or app admin) creates a director instance who might not have yet registered himself/herself in the app through ASP.NET Core Identity. So they're not yet an Identity User. As the application mainly serves the film-making company, not the directors, it's essential for the film-making company to be able to have a track of all agreements, directors, movies and so on. The Identity Users, Roles etc. are saved in the database through ApplicationDbContext.

Other business domain entities like the director, the film etc. are saved in another database through DomainDbContext.

How may I handle the logic I explained above? I mean how to relate the director to Identity User when they register through ASP.NET Core Identity in the application?

I'm sort of a beginner, so please explain if my logic is right in the first place and if so, help me out for implementing it.

Thanks in advance!

I just have thought about relating a field like Email between Directors and Identity Users and based on that, decide whether a director is an ApplicationUser instance or not. I tried to register a service to handle this logic, but I think it's not the thing that I want. Also after I added the

public ApplicationUser User { get; set; }

to my director model and tried to make a migration, I realized that the migration is making a whole new table for Identity Users in the DomainDbContext which is obviously not what should it look like.

I know there are other questions related to stuff I mentioned here, but I was not able to find the answer I was looking for. I forgot to mention I'm using code-first workflow and I'm totally confused

本文标签: cHow to make use of Identity User in a model of another DbContext (ASPNET Core)Stack Overflow