Advice on Overriding SaveAsync

Advice on Overriding SaveAsync

Old forum URL:

mtavares posted on Monday, September 23, 2013

I'm currently upgrading an existing application from csla 3.8.3 to 4.5.3.  I'm using VS 2010/.NET 4.0 and was previously overriding the Save method in a BusinessListBase in which I was just executing a dataportal command object.  This is a Windows Forms managed Addin project, so in the upgrade I've switched to using BusinessBindingListBase (no problems there) and now I need to override the SaveAsync method which returns a Task(T) object instead of my object itself like the Synchronous Save used to.  I have yet to delve into asynchronous threads and await/async keywords and am looking to just keeping things synchronous for the time being.  So my question is this.  How do I create a task object from my object in order to return it from the SaveAsync Method.  My old Save override looks like this in VB:

        Public Overrides Function Save() As SoapExamCollection
            DataPortal.Execute(Of ExamAssignedCommand)(New ExamAssignedCommand(Me))
            Return Me
        End Function

What should the SaveAsync look like in this case?  Any help would be greatly appreciated.  Thanks in advance.

Copyright (c) Marimer LLC