I’m confused. In my web-app I have a simple ReadOnlyBase object holding info about a customer, that I need on every request. Therefore I stuff it into session state.
However, when I retrieve it from session state it doesn’t seem to deserialize authorization rules correctly (or at all).
I debugged my way to where the exception is thrown. It is on the first call to a CanReadProperty(<propname>, True), which eventually calls the
AuthorizationRules.HasReadAllowedRoles(propertyName)
line 264 of ReadOnlyBase in the VB version of the framework, which now returns nothing.
Then I had a look at the Core.BusinessBase and saw that it had an OnDeserializedHandler which sets up authorization rules. ReadOnlyBase doesn’t have such a handler. Shouldn’t it have one also, to set up authorization rules?
Anyway, I added an OnDeserializedHandler to ReadOnlyBase and had it call the AddAuthorizationRules but to no avail. The mAuthorizationRules is still nothing.
I’ve searched through the forum and think it relates to the problems described in this thread:
http://forums.lhotka.net/forums/thread/5398.aspx
and it looks like the Dictionary(Of TKey, TValue) is the culprit, by not deserializing properly (or maybe doesn’t serialize it's values at all).
I’m really lost on this issue. Have any of you guys stumbled upon this and found a solution.
/Henrik
Just wanted to add to my first post.
Another thing that wonders me is that the member that holds authorization rules in ReadOnlyBase i different from that in Core.BusinessBase. It's decalared like this:
<NotUndoable()> _
<NonSerialized()> _
Private mAuthorizationRules As New Security.AuthorizationRules(Me.GetType)
and the property that returns it i declared as
Protected ReadOnly Property AuthorizationRules() As Security.AuthorizationRuleswhere in Core.BusinessBase it isn't instantiated in the member declaration but in the property like this:
Protected ReadOnly Property AuthorizationRules() As Security.AuthorizationRulesI have changed the readonly base to do the same thing as Core.BusinessBase and now everything works fine.
Rocky, is this a bug in ReadOnlyBase or am I missing something?
/Henrik
Hi Rocky
It's in v2.1 RC1, but I just checked the 2.1 RTM and it has the same issues.
Henrik:Hi Rocky
It's in v2.1 RC1, but I just checked the 2.1 RTM and it has the same issues.
Yep, now it works perfectly.
Sorry for not catching this before the RTM.
Cheers
/Henrik
Copyright (c) Marimer LLC