4.5.20 on .NET 4.0 with WPF CslaDataProvider and BusinessBindingListBase

4.5.20 on .NET 4.0 with WPF CslaDataProvider and BusinessBindingListBase

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

Turntwo posted on Tuesday, April 23, 2013

In my application I have a EditListView that is the UI to maintain simple tables represented by BusinessBindingListBase derived classes (not BusinessListBase as the 3rd party grid we use wasn't playing nice with the newer Collection types, despite being WPF).  The EditListView uses a CslaDataProvider to manage the list objects, with a Save button bound to the save command.  This works fine for non-List objects in other views.  

However, when I click Save in the EditListView, the application locks up - the CslaDataProvider is waiting for the save to complete but it never does.  The changes are saved to the database (Child_Update/Insert runs fine), but the async call seems to get stuck in limbo.  

This is a pretty serious issue, since I can't complete the upgrade if none of the table maintenance views are going to allow saving.  

I tried switching from BusinessBindingListBase to BusinessListBase and setting IsAsynchronous on the CslaDataProvider to True.  Neither had any effect.  


Looked into what is different in BusinessBase (where the save through CslaDataProvider worked), and there is an isSync parameter passed to the SaveAsync - if it is true, the SaveSync does a synchronous update on the DataPortal.  Hacked up BusinessBindingListBase to do the same, and it works now.  

Since there is already a SaveAsync(bool), I went with the quite ugly version:

private bool isSync;

 public T Save()




   isSync = true;

        var result = SaveAsync().Result;

   isSync = false;

   return result;


      catch (AggregateException ex)


        if (ex.InnerExceptions.Count > 0)

          throw ex.InnerExceptions[0];





public virtual async Task<T> SaveAsync()


      T result;

      if (this.IsChild)

        throw new InvalidOperationException(Resources.NoSaveChildException);


      if (_editLevel > 0)

        throw new InvalidOperationException(Resources.NoSaveEditingException);


      if (!IsValid)

        throw new Rules.ValidationException(Resources.NoSaveInvalidException);


      if (IsBusy)

        // TODO: Review this resource text

        throw new InvalidOperationException(Resources.BusyObjectsMayNotBeSaved);


      if (IsDirty)

if (isSync)

result = DataPortal.Update((T)this);


result = await DataPortal.UpdateAsync<T>((T)this);


        result = (T)this;

      OnSaved(result, null, null);

      return result;



This looks like a bug to me, and I'm sure you can come up with a more elegant fix - also needs to be fixed in BusinessListBase.  




RockfordLhotka replied on Wednesday, April 24, 2013

This is fixed in the upcoming release.


RockfordLhotka replied on Friday, April 26, 2013

I recommend trying the 4.5.24 RC prerelease I just made available in nuget. That version should resolve your issue.

Copyright (c) Marimer LLC