CSLA .NET

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

Dynamic List Base Removing Items Never Calls DataPortal

rated by 0 users
Answered (Not Verified) This post has 0 verified answers | 1 Reply | 1 Follower

Top 150 Contributor
50 Posts
Todd Haehn posted on Thu, May 16 2013 1:10 PM

When I remove an item from a Dynamic List, Shouldn't the Update be called right away?  Here is the code from the View Model:

        private void OnDeleteSessionConfirmDialogClosed(IMessageBox messageBox)

        {

            if (messageBox.WasSelected(MessageBoxButtons.Yes))

            {

                Model.SessionList.Remove(Session);

            }

        }

I tried to save after it was removed, but the object was marked as busy and I couldn't apply edits:

        private void OnDeleteSessionConfirmDialogClosed(IMessageBox messageBox)

        {

            if (messageBox.WasSelected(MessageBoxButtons.Yes))

            {

                Model.SessionList.Remove(Session);

                Session.ApplyEdit();

                Session.BeginSave((o, e) =>

                    {

                        if (e.Error != null)

                        {

                            throw e.Error;

                        }                        

                    });

            }

        }

I don't think I need to do this as the Dynamic List should save automatically...Correct?  It does dissappear off the list in the datagrid, but it never disappears from the database...any help would be appreciated!  I am using Silverlight 5 with CSLA 4.3 (I believe).

Todd

 

All Replies

Top 10 Contributor
9,270 Posts
Suggested by RockfordLhotka

If I remember correctly, the dynamic root list class only triggers insert/update/delete operations due to data binding behaviors, not arbitrary method calls. In other words, to trigger its automatic behavior through code your code will need to simulate normal datagrid method/event calls.

Rocky

Page 1 of 1 (2 items) | RSS

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