How could i achieve this? I have the value returned from the sp assigned to a property say ResultCode of the business object. What should i do to get this value on front end?
Thanks
Simi
Is the object your deleting a parent object, child object or list object?
Can you do a LoadProperty on the ResultCode property with the returned value from the stored proc?
It is a parent object. Actually the property is loaded with value. My doubt is how could i return this value to the front end. Because the static method for Delete is returning void (no parameters).
Thanks
Simi
How does the UI tell your business object that it needs to be deleted?
The Delete method marks the object ready for deletion. The DataPortal_Delete/DeleteSelf methods are not called until the object is saved. The save method returns a new instance of the business object that contains the saved values so you can use your saved business object to get the value of the ResultCode property.
I am using immediate deletion as jonny said.
First of all you have to understand the difference between deferred and immediate deletion.
And speaking in general terms, by definition - a data access operation is either successful or throws an exception. This is also what triggers transactions to be successful or rollback when you use TransactionScope.
So you should define your own serializable exception and in your data access code (ex DataPortal_Delete) check the resultcode and if not success throw the exception. This exception may contain the resultcode and other information that you wish to return to the client. (CSLA will by default also return the <obj> as it was in the DataPortalException that wraps the business exception (your exception)). This behaviour may be configured to NOT return the <obj>.
IE: YOUR data access code should be responsible for determining whether the save/delete was successful and if not successful throw an exception.
Whether your stored procedure returns a resultcode or whatever result should NOT be known at the UI level.
Thanks Jonny. This clarifies my doubt.
Thanks
Simi
Copyright (c) Marimer LLC