Burrows forces databinding on controls, even if we don't want to
Description
Environment
Activity

Kailuo Wang April 3, 2009 at 1:02 PM
will be fixed by

Kailuo Wang April 3, 2009 at 8:46 AM
we are working on a better solution for stateful fields handling.
Prior to that, here is a couple of alternative solutions:
you can disable the statefulfield handling for a control using either an attribute (IgnoreStatefulFields) or by implementing an interface( IStatefulFieldsControl).

Antoine Jaussoin March 24, 2009 at 2:50 AM
Another possible way (and better than the last one I think):
Adding the BaseDataBoundControl to the list of filtered base types, on the StateFulFieldsControlFilter class :
private readonly Type[] filteredBaseTypes = new Type[]
{
typeof (BaseValidator),
typeof (BaseDataBoundControl)
};
This works as well. But again, am I not filtering too much by filtering all BaseDataBoundControl...

Antoine Jaussoin March 23, 2009 at 10:41 AM
Possible way to fix it: I'm making the asumption that their won't be any StateFul field in a DataBindable control... this solution works for me, but is it a viable solution? Is my asumption any good?
public void Process()
{
if (HasStatefulField)
ProcessFields();
if (Control is BaseDataBoundControl) <-- HERE
return; <-- HERE
foreach (Control control in Control.Controls)
{
if (StatefulFieldsControlFilter.Instance.CanHaveStatefulFields(control))
CreateSubProcessor(control, pageModule).Process();
}
}
Details
Details
Assignee

Reporter

Hello,
I have a GridView on my page, and I found very disturbing that after having installed Burrows, my GridView was DataBinding by itself, even if none of my code was asking for it.
I installed Burrows source code, and I found out that this bit of code here (below) seems to browse recursively all the controls on a page, and, when browsing the Controls collection on my GridView, trigger the databinding.
I think it's a major flaw since Burrows shouldn't interfere on when a control is databound.
This is the code, in [...]Burrows\src\NHibernate.Burrow.WebUtil\Impl\StatefulFieldProcessor.cs:
public void Process() {
if (HasStatefulField)
ProcessFields();
foreach (Control control in Control.Controls)
{
if (StatefulFieldsControlFilter.Instance.CanHaveStatefulFields(control))
CreateSubProcessor(control, pageModule).Process();
}
}
I don't know if it's possible to find the StatefulField an other way, or to prevent a control from databinding...
Thanks!!
Antoine