StrataFrame Forum

businesslayer.getenumerable(True)

http://forum.strataframe.net/Topic26545.aspx

By Charles R Hankey - 3/19/2010

Poking around in source code I find the overload for businesslayer.getenumerable



_

Public Function GetEnumerable(ByVal separateInstances As Boolean) As IEnumerable

If separateInstances Then

'-- Create a new business binding source that will be disposed after use

Dim bbs As New BusinessBindingSource(True)

bbs.BusinessObject = Me

Return bbs

Else

Return Me.GetEnumerable()

End If

End Function





This looks cool. I'm trying to come up with a scenario where is can be useful as I am pretty sure there may be a lot of them.



Suggestions?
By Dustin Taylor - 3/23/2010

This has to do with working through a web environment.  The WBBS actually uses a shared data table for parsing.  But the issue on the web is that a root BO is most likely stored in the session.  So you may have two objects referencing the same BO which would cause an issue.  This creates a separate BBS instance so that there is not any cross pollination in a web environment when referencing the same BO through multiple controls using the standard WBBS binding.

I talked to Trent about it to come up to speed (I've never had occasion to use that override myself), and he mentioned that it was recently updated:

 

''' <summary>
        ''' Changed 3/8/2010 for forum post http://forum.strataframe.net/FindPost26315.aspx.  The issue was that a clean up property
        ''' had been added between 1.6 and 1.7 to clean up memory as DevExpress grids (amongst others) would not automatically call the
        ''' Dispose of the enumerator, creating memory leaks.  However, on the web side of things, this caused the shared data table
        ''' to be destroyed before it was ever used.  So the autoDisposeSourceAfterUse param was added so that each environmental
        ''' BBS could set this explicitly.  As of 3/8/2010, the only place that set the second parm as False was the WebBusinessBindingSourceView
        ''' so that DevExpress web grids would work.
        ''' </summary>
        <EditorBrowsable(EditorBrowsableState.Never)> _
        Public Function GetEnumerable(ByVal separateInstances As Boolean, ByVal autoDisposeSourceAfterUse As Boolean) As IEnumerable
            If separateInstances Then
                '-- Create a new business binding source that will be disposed after use
                Dim bbs As New BusinessBindingSource(autoDisposeSourceAfterUse)
                bbs.BusinessObject = Me
                Return bbs
            Else
                Return Me.GetEnumerable()
            End If
        End Function

By Charles R Hankey - 3/23/2010

Thanks Dustin



I haven't done any web stuff with SF yet but good to know it will be there when I need it Smile