Advice needed on subclassed BusinessBase, BusinessListBase, etc.

Advice needed on subclassed BusinessBase, BusinessListBase, etc.

Old forum URL: forums.lhotka.net/forums/t/1650.aspx


david.wendelken posted on Tuesday, October 31, 2006

I've been subclassing BusinessBase and BusinessListBase so I can build my business object libraries from the subclasses per Rocky's recommendation.  It should reduce the amount of maintenance to make use of new CSLA versions plus allow me to customize things to meet my own needs.

I've made the list of broken rules publically available so that I can bind them to the UI control.  That way, it automagically contains all the things wrong with that object (or not).

I'm now trying to make the list of actual rules (whether broken or not) publically available so that users, QA testers, documentation writers, (and so on) can see them.   By binding the property to a UI control I can provide an inexpensive way to help the application system be self-documenting.

I'm having a big of a problem with this last task.  The classes/interfaces that appear to contain the information I need are defined as internal.  (RulesList, RuleMethod and IRuleMethod)

If I understand things correctly, the only way to access this internal information is to put my subclasses into the same project as CSLA.  I had originally intended for my subclasses to be in their own project to cut down on maintenance for new CSLA sub-releases.  Anyone know of a better way to make this work?

guyroch replied on Tuesday, October 31, 2006

One word... REFLECTION

With reflection you can even change the value of a private variable, so I don't think the internal modifier will be much of an issue.

 

david.wendelken replied on Tuesday, October 31, 2006

guyroch:

One word... REFLECTION

With reflection you can even change the value of a private variable, so I don't think the internal modifier will be much of an issue.

I hadn't understood that you could mess with internal or private variables via reflection. 

Interesting  :)

and Scary :{ !!

Seems like that might enable people to hack their way into data they shouldn't be allowed to see...

guyroch replied on Tuesday, October 31, 2006

david.wendelken:

and Scary :{ !!

Very scary... ummmm... this thread will self destruct in 5 seconds  :-o

 

JoeFallon1 replied on Wednesday, November 01, 2006

In Csla 2.1 Rocky added support for getting a list of rules that apply to a Type.

''' <summary>

''' Returns an array containing the text descriptions of all

''' validation rules associated with this object.

''' </summary>

''' <returns>String array.</returns>

''' <remarks></remarks>

Public Function GetRuleDescriptions() As String()

Dim result As New List(Of String)

Dim rules As ValidationRulesManager = RulesToCheck

For Each de As Generic.KeyValuePair(Of String, RulesList) In rules.RulesDictionary

For Each rule As IRuleMethod In de.Value.GetList(False)

result.Add(CObj(rule).ToString)

Next

Next

Return result.ToArray

End Function

Joe

david.wendelken replied on Wednesday, November 01, 2006

JoeFallon1:

In Csla 2.1 Rocky added support for getting a list of rules that apply to a Type.

''' <summary>
''' Returns an array containing the text descriptions of all
''' validation rules associated with this object.
''' </summary>
''' <returns>String array.</returns>
''' <remarks></remarks>
Public Function GetRuleDescriptions() As String()

I've been looking like crazy for that capability.  Thanks!

Copyright (c) Marimer LLC