Multiple Binding Source Sample Project Logical Bug

Multiple Binding Source Sample Project Logical Bug

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


comp1mp posted on Tuesday, July 17, 2012

Hi,

Don't know if this is the place to post this.

Multiple BindingSource project which comes with 4.0.0 has the following extension code for a BindingSource.

Normal 0 false false false EN-US X-NONE X-NONE

public static void UnbindDataSource(this BindingSource source, bool cancel, bool isRoot)

{

    IEditableObject current = null;

    // position may be -1 if bindigsource is already unbound which results in Exception when trying to address current

    if ((source.DataSource != null) && (source.Position > -1))

    {

        current = source.Current as IEditableObject;

    }

 

    // set Raise list changed to True

    source.RaiseListChangedEvents = false;

    // tell currency manager to suspend binding

    source.SuspendBinding(); //RESEARCH:This invokes IEditableObject.EndEdit()

 

    if (isRoot) source.DataSource = null;

    if (current == null) return;

 

    if (cancel)

    {

        current.CancelEdit();

    }

    else

    {

        current.EndEdit();

    }

}

 

The issue is the call to SuspendBinding.

This invokes IEditableObject.EndEdit underneath the hood. The call to CancelEdit will always be ignored by Csla b/c the IEditableObject.EndEdit call sets BindingEdit = false.

 

Please let me know if there is a different place I need to be sending this information to.

Thanks,

Matthew

 

 

JonnyBee replied on Tuesday, July 17, 2012

Hi,

Thanks, I will look into it when I am back from vacation. 

Copyright (c) Marimer LLC