SubmitOperation Class

WCF RIA Services

[WCF RIA Services Version 1 Service Pack 2 is compatible with either .NET framework 4 or .NET Framework 4.5, and with either Silverlight 4 or Silverlight 5.]

Represents an asynchronous submit operation.


Namespace:  System.ServiceModel.DomainServices.Client
Assembly:  System.ServiceModel.DomainServices.Client (in System.ServiceModel.DomainServices.Client.dll)

public sealed class SubmitOperation : OperationBase

The SubmitOperation type exposes the following members.

Public propertyCanCancelGets a value that indicates whether this OperationBase is currently in a state that enables it to be canceled. (Inherited from OperationBase.)
Public propertyChangeSetGets change set being submitted.
Public propertyEntitiesInErrorGets any entities that have errors after the submit operation completes.
Public propertyErrorGets the operation error if the operation failed. (Inherited from OperationBase.)
Public propertyHasErrorGets a value that indicates whether the operation failed. (Inherited from OperationBase.)
Public propertyIsCanceledGets a value that indicates whether this operation has been canceled. (Inherited from OperationBase.)
Public propertyIsCompleteGets a value that indicates whether this operation has completed. (Inherited from OperationBase.)
Public propertyIsErrorHandledGets or sets a value that indicates whether the operation error has been handled. (Inherited from OperationBase.)
Protected propertyResultGets the result of the asynchronous operation. (Inherited from OperationBase.)
Protected propertySupportsCancellationGets a value that indicates whether this operation supports cancellation. (Inherited from OperationBase.)
Public propertyUserStateGets the optional user state for this operation. (Inherited from OperationBase.)

Public methodCancelCancels the operation. (Inherited from OperationBase.)
Protected methodCancelCoreWhen overridden in a derived class, provides the logic to cancel the operation. (Inherited from OperationBase.)
Protected methodComplete(Exception)Completes a failed operation with the specified error. (Inherited from OperationBase.)
Protected methodComplete(Object)Completes a successful operation with the specified result. (Inherited from OperationBase.)
Public methodEquals (Inherited from Object.)
Protected methodFinalize (Inherited from Object.)
Public methodGetHashCode (Inherited from Object.)
Public methodGetType (Inherited from Object.)
Protected methodInvokeCompleteActionInvokes the completion callback. (Inherited from OperationBase.)
Public methodMarkErrorAsHandledSpecifies that an error encountered in an operation is handled. (Inherited from OperationBase.)
Protected methodMemberwiseClone (Inherited from Object.)
Protected methodOnPropertyChangedCalled when the value of a property changes. (Inherited from OperationBase.)
Protected methodRaisePropertyChangedRaises the System#ComponentModel#INotifyPropertyChanged#PropertyChanged() event. (Inherited from OperationBase.)
Public methodToString (Inherited from Object.)

Public eventCompletedOccurs when the operation completes. (Inherited from OperationBase.)

Explicit interface implemetationPrivate eventINotifyPropertyChanged.PropertyChangedOccurs when a property value changes. (Inherited from OperationBase.)

The following example shows a callback method named OnSubmitCompleted that accepts a SubmitOperation object as a parameter. It uses this object to check for errors and mark the errors as handled.

private void SaveButton_Click(object sender, RoutedEventArgs e)
    _customerContext.SubmitChanges(OnSubmitCompleted, null);

private void RejectButton_Click(object sender, RoutedEventArgs e)

private void CustomerGrid_RowEditEnded(object sender, DataGridRowEditEndedEventArgs e)

private void CheckChanges()
    EntityChangeSet changeSet = _customerContext.EntityContainer.GetChanges();
    ChangeText.Text = changeSet.ToString();

    bool hasChanges = _customerContext.HasChanges;
    SaveButton.IsEnabled = hasChanges;
    RejectButton.IsEnabled = hasChanges;

private void OnSubmitCompleted(SubmitOperation so)
    if (so.HasError)
        MessageBox.Show(string.Format("Submit Failed: {0}", so.Error.Message));

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.