实体框架用户和角色管理

时间:2020-12-31 11:24:16

I have a Visual Studio solution which contains several projects :

我有一个包含几个项目的Visual Studio解决方案:

  1. Domain classes
  2. Data access layer - which contains DB context
  3. 数据访问层 - 包含DB上下文

  4. MVC application.

The MVC application by default uses existing classes for user management and it also has his own ApplicationDbContext. In this case we have two DB contexts.

默认情况下,MVC应用程序使用现有的类进行用户管理,它也有自己的ApplicationDbContext。在这种情况下,我们有两个DB上下文。

What is your experience regarding the user management ? Would it be better if I create my own classes for user management and place them to the Domain Classes project. I think it would be much easier latter for maintaining and in this case there will be only one DBContext. Another possible problem can be relations between existing ApplicationUsers(from the MVC project model) and classes from the Domain Classes Project. Or maybe to move the ApplicationUser class definition to the DomainClasses project ?

您对用户管理的体验是什么?如果我为用户管理创建自己的类并将它们放到Domain Classes项目中会更好吗?我认为后面的维护会更容易,在这种情况下只有一个DBContext。另一个可能的问题可能是现有ApplicationUser(来自MVC项目模型)与Domain Classes Project中的类之间的关系。或者可能将ApplicationUser类定义移动到DomainClasses项目?

1 个解决方案

#1


1  

I highly recommend MembershipReboot. You have the option of using its built in UserAccount or using your own.

我强烈推荐MembershipReboot。您可以选择使用其内置的UserAccount或使用您自己的UserAccount。

On a side note Brock is part of Thinktecture. In one of the asp.net stand-ups it was mentioned that the team may just recommend a 3rd-party identity provider instead of role their own. That was my understanding but maybe I am just being hopeful. I think it was this one https://www.youtube.com/watch?v=CMTd5yS-yFE&list=PL0M0zPgJ3HSftTAAHttA3JQU4vOjXFquF&index=2 but don't hold me to that.

另外,Brock是Thinktecture的一部分。在其中一个asp.net站点中,有人提到团队可能只推荐第三方身份提供者而不是自己的角色。这是我的理解,但也许我只是充满希望。我认为这是一个https://www.youtube.com/watch?v=CMTd5yS-yFE&list=PL0M0zPgJ3HSftTAAHttA3JQU4vOjXFquF&index=2但不要抱我这样。

#1


1  

I highly recommend MembershipReboot. You have the option of using its built in UserAccount or using your own.

我强烈推荐MembershipReboot。您可以选择使用其内置的UserAccount或使用您自己的UserAccount。

On a side note Brock is part of Thinktecture. In one of the asp.net stand-ups it was mentioned that the team may just recommend a 3rd-party identity provider instead of role their own. That was my understanding but maybe I am just being hopeful. I think it was this one https://www.youtube.com/watch?v=CMTd5yS-yFE&list=PL0M0zPgJ3HSftTAAHttA3JQU4vOjXFquF&index=2 but don't hold me to that.

另外,Brock是Thinktecture的一部分。在其中一个asp.net站点中,有人提到团队可能只推荐第三方身份提供者而不是自己的角色。这是我的理解,但也许我只是充满希望。我认为这是一个https://www.youtube.com/watch?v=CMTd5yS-yFE&list=PL0M0zPgJ3HSftTAAHttA3JQU4vOjXFquF&index=2但不要抱我这样。