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.
System.Object
System.ServiceModel.DomainServices.Client.OperationBase
System.ServiceModel.DomainServices.Client.SubmitOperation
System.ServiceModel.DomainServices.Client.OperationBase
System.ServiceModel.DomainServices.Client.SubmitOperation
Namespace: System.ServiceModel.DomainServices.Client
Assembly: System.ServiceModel.DomainServices.Client (in System.ServiceModel.DomainServices.Client.dll)
The SubmitOperation type exposes the following members.
| Name | Description | |
|---|---|---|
|
CanCancel | Gets a value that indicates whether this OperationBase is currently in a state that enables it to be canceled. (Inherited from OperationBase.) |
|
ChangeSet | Gets change set being submitted. |
|
EntitiesInError | Gets any entities that have errors after the submit operation completes. |
|
Error | Gets the operation error if the operation failed. (Inherited from OperationBase.) |
|
HasError | Gets a value that indicates whether the operation failed. (Inherited from OperationBase.) |
|
IsCanceled | Gets a value that indicates whether this operation has been canceled. (Inherited from OperationBase.) |
|
IsComplete | Gets a value that indicates whether this operation has completed. (Inherited from OperationBase.) |
|
IsErrorHandled | Gets or sets a value that indicates whether the operation error has been handled. (Inherited from OperationBase.) |
|
Result | Gets the result of the asynchronous operation. (Inherited from OperationBase.) |
|
SupportsCancellation | Gets a value that indicates whether this operation supports cancellation. (Inherited from OperationBase.) |
|
UserState | Gets the optional user state for this operation. (Inherited from OperationBase.) |
| Name | Description | |
|---|---|---|
|
Cancel | Cancels the operation. (Inherited from OperationBase.) |
|
CancelCore | When overridden in a derived class, provides the logic to cancel the operation. (Inherited from OperationBase.) |
|
Complete(Exception) | Completes a failed operation with the specified error. (Inherited from OperationBase.) |
|
Complete(Object) | Completes a successful operation with the specified result. (Inherited from OperationBase.) |
|
Equals | (Inherited from Object.) |
|
Finalize | (Inherited from Object.) |
|
GetHashCode | (Inherited from Object.) |
|
GetType | (Inherited from Object.) |
|
InvokeCompleteAction | Invokes the completion callback. (Inherited from OperationBase.) |
|
MarkErrorAsHandled | Specifies that an error encountered in an operation is handled. (Inherited from OperationBase.) |
|
MemberwiseClone | (Inherited from Object.) |
|
OnPropertyChanged | Called when the value of a property changes. (Inherited from OperationBase.) |
|
RaisePropertyChanged | Raises the System#ComponentModel#INotifyPropertyChanged#PropertyChanged() event. (Inherited from OperationBase.) |
|
ToString | (Inherited from Object.) |
| Name | Description | |
|---|---|---|
|
INotifyPropertyChanged.PropertyChanged | Occurs 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) { _customerContext.RejectChanges(); CheckChanges(); } private void CustomerGrid_RowEditEnded(object sender, DataGridRowEditEndedEventArgs e) { CheckChanges(); } 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)); so.MarkErrorAsHandled(); } CheckChanges(); }