How to implement ASP.NET membership provider in my domain model

后端 未结 4 1843
花落未央
花落未央 2020-12-23 18:01

In a website, I need to integrate membership and authentication. So I want to use the functionality of ASP.NET Membership, but I have other custom stuff, that a \"user\" has

4条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-23 18:19

    I've extended MembershipUser and created my own version of the SqlMembershipProvider to map to my existing domain, and its working well, in production now.

    MembershipUser is essentially a view over my User table. My extended MembershipUser class includes profile/account-style properties instead of using the default SqlProfileProvider system, which is a bit fragile.

    I wasn't able to use the existing membership tables or sprocs, but wrote my own. For example, the SqlMembershipProvider uses a GUID as an opaque key, but the production system uses a plain old int. All of the dates are UTC, etc. too.

    All of the extra User functionality is accessed via the User domain not via Membership methods.

    HTH.

提交回复
热议问题