ObjectHydrated pattern in DotNetNuke UserInfo is not good

DotNetNuke UserMembership class (as well as some others) hasObjectHydrated property as a flag is object loaded or not.

In my opinion implementation of this pattern is fragile and not reliable.

Get  Membership Property of  UserInfo tries to load data from UserMembership, which is not good, because Get (read-only) property should not change state of the object.
It can cause different behavior in Debug and Release modes, if any code like Debug.WriteLine(ObjUser.Membership.Email) will be used.

Also assigning any of UserMembership properties (e.g. Email) sets has ObjectHydrated flag to true, even if other properties are not filled.

I've noticed a few times that FillUserMembership wasn't called when expected and properties of UserMembership were null, even if ObjectHydrated flag was true.It caused exceptions, that are not reproducible.

I've noticed that DNN support has reports about the issue(see here and here)

  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati
posted @ Wednesday, March 15, 2006 6:16 AM
Print

Comments on this entry:

# re: ObjectHydrated pattern in DotNetNuke UserInfo is not good

Left by Hal Lesesne at 3/15/2006 7:14 AM
Gravatar
IMHO – You might simply be misunderstanding the use of ObjectHydrated, not that the pattern is necessarily bad.

If my understanding is correct, ObjectHydrated follows a different pattern the the “is Dirty” type of property often found in O/R objects.

With OH it appears that you either have an empty object (created but with no fields set) or an object with SOME value set.

An isDirty pattern would take a different approach in that in a given state (filled or unfilled) an object is dirty with ANY change (from an empty state to a filled state to a changed state), so that you can determine if some sort of a persist needs to occur. Very useful but, quite possibly, not what the DNN architects were shooting for.

As for the exceptions, I wonder if the FillUserMembership doesn't get called either because of caching or because the debug user hasn't attempted authentication? Do you know what the exceptions were or what they were related to? Can you check your DNN log as it should be there?

Just my $.02 and thanks for the post.

# re: ObjectHydrated pattern in DotNetNuke UserInfo is not good

Left by Michael Freidgeim at 3/15/2006 12:05 PM
Gravatar
Hal,
Thank you for clarification. My understanding was that ObjectHydrated means that not SOME, but ALL values for consistent object state are set. E.g if email is set, but username doesn't, UserInfo object is not completed, can't be saved and is not fully Hydrated.

# re: ObjectHydrated pattern in DotNetNuke UserInfo is not good

Left by almny at 5/17/2009 9:45 PM
Gravatar
i will made to now i cann;t get user info by code in dnn :(

Your comment:



(not displayed)


 
 
 
 
 

Live Comment Preview:

 
«February»
SunMonTueWedThuFriSat
2930311234
567891011
12131415161718
19202122232425
26272829123
45678910