CSLA .NET

Vibrant discussion about CSLA .NET and using the framework to build great business applications.

Forum has moved

New location: CSLA .NET forum


CSLA .NET Resources:
  • CSLA .NET forum
  • CSLA .NET home page
  • OnChildChanged Not firing from TryUpdateModel call

    rated by 0 users
    Not Answered This post has 0 verified answers | 0 Replies | 1 Follower

    Not Ranked
    1 Posts
    EbenK posted on Wed, Jul 20 2011 11:01 AM

     

    I am working with an MVC 3 application using CSLA 4.0, and I have set in the global.asax to use the CslaModelBinder.  I have a top level object that derives from BusinessBase<T> (I will call it Labor), and that object has a child collection (LaborLogList) that derives from BusinessListBase<T> that is made up of objects (LaborLog) that derive from BusinessBase<T>.

     

    I need to have some properties update on the Labor object whenever the LaborLogList has been changed (ie: something was inserted into the collection, removed from the collection, or updated in the collection).  In order to achieve this requirement, I created an override for OnChildChanged at the Labor object level, and I am easily able to capture the collection changed events (insert and remove), but I am having some trouble in trying to capture the update events.  I expected to be able to just listen for the property name that I expect to change through e.PropertyChangedArgs.PropertyName, but the child changed event is never being fired for the properties that I have updated through my UI.

     

    After further investigation of this, it seems that the any property that I update from the UI will not fire the OnChildChanged event at the parent level.  Here is an sample from  the controller method I am using:

     

    if (TryUpdateModel(logVM))
    {
    Labor labor = Labor.GetByOID(returnId, true);
     
     labor.Logs.Add(logVM.Log);
    
     ...
     
     labor.Save();
    }
    
    
     

    It would appear that the TryUpdateModel method does not fire the Csla OnChildChanged event.  The property values are changing, but the event is not being seen at the parent level.  Does anyone have any ideas on why this may be happening, or how I could get around it?

    Thanks,

    Eben

    Page 1 of 1 (1 items) | RSS

    Copyright (c) 2006-2014 Marimer LLC. All rights reserved.
    Email admin@lhotka.net for support.
    Powered by Community Server (Non-Commercial Edition), by Telligent Systems