views:

25

answers:

1

Can anyone advise me on extending the out-of-the-box scaffold within SubSonic 2?

When a user clicks the Save button, which triggers the btnSave_Click void, I would like to execute another stored procedure based on the record they have just updated.

What's the best approach? Many thanks.

A: 

From what I see on SubSonic 2 source code, when you trigger the btnSave_Click there is no other function that you can call as it is.

So you need to modified the source code and recreate the subsonic 2 dll (that is very easy).

So if you modify the source code, just place a function that runs after the save, then on your code override this function with your call.

    /// <summary>
    /// Saves the editor.
    /// </summary>
    private void SaveEditor()
    {
        if(Mode == ScaffoldMode.Edit)
            UpdateRecord(PrimaryKeyControlValue);
        else
            InsertRecord();

        SaveManyToMany();

        AfterTheSave();

        if(ReturnOnSave)
            BuildWithModeChange(ScaffoldMode.List);
    }

    public virtual void AfterTheSave()
    {
    }
Aristos