[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?
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.
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
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
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
Re: Question about membership and layered architecture
you are right Gary. I'm just complicating things aren't I:blush: Thanks
Re: Question about membership and layered architecture
Quote:
Originally Posted by
Nitesh
you are right Gary. I'm just complicating things aren't I:blush: Thanks
Maybe a little bit :) But that is why it is great to ask questions on these forums.
Gary