Welcome Guest Search | Active Topics | Log In | Register

Comment on design of profile and membership provider re:interdepedency Options · View
juanp2
#1 Posted : Saturday, October 11, 2008 4:24:01 AM
Rank: Member


Joined: 9/27/2008
Posts: 20
I was trying to use the Profile provider of YAF and integrate or extend it to work with the default asp.net Membership and Role Providers.

However, unless I am not understanding something, it appears impossible. The Yaf Profile provider appears tightly coupled to the YAF Membership provider. In the stored procedure yaf_profile_getprofiles, a join is done:

SELECT m.UserName, m.LastActivity, p.*
FROM [smarter].[yaf_prov_Membership] m, [smarter].[yaf_prov_Profile]

This works I'm sure for the purposes of YAF, but does this not break the idea of independant-plugable providers? Would it not make more sense keep the profile provider independant of the membership provider? i.e. duplicate the information in the profile table, thereby breaking the dependancy and use a trigger on the membership to update the profile's 'username' and 'last activity'? Or in reality, if the username and last activity date are needed, they should be retrieved from the membership, not from the profile (although I have a hunch this design is for performance reasons).

Just a comment if it helps and if I'm out to lunch.. I can accept it, no need to flame me. IMHO, if an eye is kept to making YAF easily integrated into other projects, it would be very very popular.

Jaben
#2 Posted : Saturday, October 11, 2008 4:44:47 AM

Rank: YAF Head Dude



Joined: 10/10/2004
Posts: 3,045
Location: Honolulu, HI
Well, originally I didn't see that anyone would be using the YAF Profile provider if you were not going to use the other YAF provides.

Out of curiosity, why not use the ASP.NET profile provider or the SQL Profile Provider?

As far as impossible -- not so much. I had to do this for an integration project and wanted to use YAF Profile Provide (but I wrote custom Membership and Role providers).

It's actually pretty easy (maybe a 1 hour job) because it just requires SQL procedure updates. Took changing five of the profile sprocs.

Your suggestion I have thought about... but there are some issues.

As far as the SQL decoupling -- it would be great. The irritations are the need for the Provider User Key and "IsUserOnline" flag -- which is flatly unavailable in the Profile.

Kind of have to blame MS design here. Your suggestion of code/sql mix is possible, and might be the only way to truly decouple from SQL dependencies. But it creates it's own dependence: I haven't seen many providers pull from the current membership/role providers. Not that it can't work -- I just haven't seen anyway use that method.

So basically, it just wasn't something I felt like getting into for this release.
"When you are grateful, fear disappears and abundance appears”."

juanp2
#3 Posted : Saturday, October 11, 2008 5:07:52 AM
Rank: Member


Joined: 9/27/2008
Posts: 20
A couple reasons for not using the asp.net profile provider.

One is laziness/cutting corners. I thought I might be able to add my profile requirements to the YAF profile provider and use it in the main project, thereby gaining the advantages of what looks to me to be a far better designed profile provider than the ASP.NET.

The other, is I wasn't sure it would work 'out of the box' without running into hidden side-effects or faulting functionality later down the road. Since you have a custom provider, you could theoretically add functionality in a future release that the default provider won't provide.

But I might just give it try. From what you implying, if I just add the YAF profile properties to the AspNetSqlProfileProvider in the web config and it'll work? And you can promise me you won't break the API of the provider in a future release of YAF?

And thank you for the reply. I see now where you are coming from, and the issues with the microsoft design.



Jaben
#4 Posted : Saturday, October 11, 2008 6:54:35 AM

Rank: YAF Head Dude



Joined: 10/10/2004
Posts: 3,045
Location: Honolulu, HI
juanp2 wrote:
But I might just give it try. From what you implying, if I just add the YAF profile properties to the AspNetSqlProfileProvider in the web config and it'll work? And you can promise me you won't break the API of the provider in a future release of YAF?


Yeah, it's the same regardless of the provider.

<profile enabled="true" defaultProvider="SqlProfileProvider" inherits="YAF.Classes.Utils.YafUserProfile">
... connection strings, etc ...
</profile>

The inherits function is part of the profile system. Even if the YafUserProfile class changes, it will work fine in the future as well. (Profile Providers are very dynamic.) You can also add additional fields to the specification. All profiles providers (including YAF's) handle the different methods of declaring profile fields.
"When you are grateful, fear disappears and abundance appears”."

juanp2
#5 Posted : Saturday, October 11, 2008 7:09:26 AM
Rank: Member


Joined: 9/27/2008
Posts: 20
Thank you, that is a really easy solution. I totally forgot about the ability to 'inheret' in the config file. Obvious is code, but not so obvios in XML. I was going off the deep end tring to add yaf profile related properites directly into the default provider itself.

I had the last version of YAF 95% integrated into a custom project and when I saw this beta version was going to use the membership, role, profile providers I stopped. This version is such a treat to work with. Nicely done.

Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

YAFPro Theme Created by Jaben Cargman (Tiny Gecko)
Powered by YAF 1.9.3 RC2 | YAF © 2003-2008, Yet Another Forum.NET
This page was generated in 0.092 seconds.

SourceForge.net Logo Powered by ASP.NET v2.0 411ASP.NET