Results 1 to 7 of 7

Thread: [RESOLVED] Question about membership and layered architecture

  1. #1

    Thread Starter
    PowerPoster Nitesh's Avatar
    Join Date
    Mar 2007
    Location
    Death Valley
    Posts
    2,556

    Resolved [RESOLVED] Question about membership and layered architecture

    Hi guys,

    I have created a class library project that acts as my data access layer. It is seperate from my website project, In my website I use a custom membership provider.

    Problem is, I now need to interact with the provider in my class library but I can't since it isn't part of the class library. Do i create a user class in my class library so I can interact with user information?

    It seems like duplicating code and much more work. Any suggestions?

  2. #2
    Fanatic Member davebat's Avatar
    Join Date
    Dec 2002
    Posts
    727

    Re: Question about membership and layered architecture

    I dont think youll need too - but I may be wrong. your web layer is protected by membership, and so only authenticated people accessing the web layer will access the db layer.

  3. #3
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: Question about membership and layered architecture

    Hello,

    No, you certainly shouldn't need to do that. If you have implemented a Custom Membership Provider, then you should be able to tell your application to use that, when it is referring to anything to do with Membership. This is typically done in the web.config file for your application.

    Can you provide an example of how, and where, you need to interact with it?

    Gary

  4. #4

    Thread Starter
    PowerPoster Nitesh's Avatar
    Join Date
    Mar 2007
    Location
    Death Valley
    Posts
    2,556

    Re: Question about membership and layered architecture

    thanks guys. In my website I've set everything up in the web config that enables me to use the membership and profile providers.

    Now in my DAL which is a class library project I need to pass the membershipuser object as an argument to a function:

    Code:
    Public Function SendInvitations(ByVal User As MemberShipUser, ByVal ToEmailArray As String, ByVal Message As String) As String
    
    End Function
    but I cant use the membership provider in the class library. How would I get access to it? Inside the function I need to use the User.Email and ProviderUserKey etc

  5. #5
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: Question about membership and layered architecture

    Hello,

    Well you "can" use the MembershipUser, all you would need to do is add a reference to the System.Web.Security namespace in your class library project, but the question is whether you need do. It is unlikely that you are using many of the properties of the MemberShipUser class, so why not simply pass through the information that you are using.

    Gary

  6. #6

    Thread Starter
    PowerPoster Nitesh's Avatar
    Join Date
    Mar 2007
    Location
    Death Valley
    Posts
    2,556

    Re: Question about membership and layered architecture

    you are right Gary. I'm just complicating things aren't I Thanks

  7. #7
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: Question about membership and layered architecture

    Quote Originally Posted by Nitesh View Post
    you are right Gary. I'm just complicating things aren't I Thanks
    Maybe a little bit But that is why it is great to ask questions on these forums.

    Gary

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width