CSLA .NET 3.6 (Windows and Silverlight) Beta 1 refresh

CSLA .NET 3.6 (Windows and Silverlight) Beta 1 refresh

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


RockfordLhotka posted on Thursday, October 09, 2008

I have posted a Beta 1 refresh (Beta 1a) of version 3.6 on www.lhotka.net.

On the .NET/Windows side there are some interesting things here:

On the Silverlight side:

We're on the way to Beta 2 in a couple weeks, and are purely in stabilization mode at this point. This code should be pretty darn good, and is final - assuming no more bugs are found :)

In other words, please download and use this code - for Windows and/or Silverlight - and let us know if you find any issues.

I'm targeting 10/20 for a Beta 2 release - just over a week away! And I expect we're just a very few weeks from a final release - all building toward us releasing 3.6 as soon after Silverlight 2.0 is released as possible.

stefan replied on Friday, October 10, 2008

I am testing CSLA.NET 3.6 (built from SVN)

I am getting a System.InvalidCastException resulting from a OnPropertyChanged called from within
a BLB derived class.

My test scenario looks like this:
EditableRoot (BusinessBase derived with three intermediate types)
 - ReadOnlyChild (managed child, ReadOnlyBase derived with two intermediate types)
 - EditableChild (managed child, BusinessBase derived with three intermediate types)
 - EditableChildList (managed child list; BusinessListBase derived with two intermediate types)
    - EditableChildListItem (BusinessBase derived with two intermediate types; two registered
         string-properties with a private backing field)

The EditableRoot object is bound to a Windows Form following the PT pattern (BindUI/UnbindUI).
The child list is bound to a DataGridView.

When I change a value in one of the EditableChildListItem object, the following happens:

In ExtendedBindingList, Child_PropertyChanged is called:
    private void Child_PropertyChanged(object sender, PropertyChangedEventArgs e)
    {
      OnChildChangedInternal(this, new ChildChangedEventArgs(sender, e, null));
    }
Then in BusinessListBase, OnChildChangedInternal is called:
    protected internal override void OnChildChangedInternal(
      object sender, ChildChangedEventArgs e)
    {
      if (RaiseListChangedEvents && e.PropertyChangedArgs != null)
      {
        DeferredLoadIndexIfNotLoaded();
        if (_indexSet.HasIndexFor(e.PropertyChangedArgs.PropertyName))
          ReIndexItem((C)sender, e.PropertyChangedArgs.PropertyName);

        int index = IndexOf((C)sender);
        if (index >= 0)
        {
          PropertyDescriptor descriptor =
            GetPropertyDescriptor(e.PropertyChangedArgs.PropertyName);
          if (descriptor != null)
            OnListChanged(new ListChangedEventArgs(
              ListChangedType.ItemChanged,
              index, GetPropertyDescriptor(e.PropertyChangedArgs.PropertyName)));
          else
            OnListChanged(new ListChangedEventArgs(
              ListChangedType.ItemChanged, index));
          return;
        }
      }

      base.OnChildChangedInternal(sender, e);
    }

I marked the line where the exception happens: In my case, the sender is the list itself.
The list item (of Type C), which initially triggered PropertyHasChanged,
can be reached through the ChildChangedEventArgs parameter e...



Stefan

RockfordLhotka replied on Friday, October 10, 2008

Thanks, that is something I just changed, and I obviously introduced a bug.

 

Rocky

Copyright (c) Marimer LLC