DomainOperationException Class
[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.]
Indicates that at least one error has occurred during the processing of the domain operations on the server.
Inheritance Hierarchy
System.Object
System.Exception
System.ServiceModel.DomainServices.Client.DomainOperationException
Namespace: System.ServiceModel.DomainServices.Client
Assembly: System.ServiceModel.DomainServices.Client (in System.ServiceModel.DomainServices.Client.dll)
Syntax
'Declaration
Public NotInheritable Class DomainOperationException _
Inherits Exception
'Usage
Dim instance As DomainOperationException
public sealed class DomainOperationException : Exception
public ref class DomainOperationException sealed : public Exception
[<SealedAttribute>]
type DomainOperationException =
class
inherit Exception
end
public final class DomainOperationException extends Exception
The DomainOperationException type exposes the following members.
Constructors
Name | Description | |
---|---|---|
DomainOperationException() | Initializes a new instance of the DomainOperationException class. | |
DomainOperationException(String) | Initializes a new instance of the DomainOperationException class with a specified message that describes the error. | |
DomainOperationException(String, Exception) | Initializes a new instance of the DomainOperationException class with a specified error message and a reference to the inner exception that is the cause of this exception. | |
DomainOperationException(String, OperationErrorStatus) | Initializes a new instance of the DomainOperationException class with a localized exception message and status. | |
DomainOperationException(String, OperationErrorStatus, Int32) | Initializes a new instance of the DomainOperationException class with a localized exception message, status and custom error code. | |
DomainOperationException(String, OperationErrorStatus, Int32, String) | Initializes a new instance of the DomainOperationException class with optional localized message, status, custom error code, and stack trace of the exception. |
Top
Properties
Name | Description | |
---|---|---|
Data | (Inherited from Exception.) | |
ErrorCode | Gets or sets the custom error code for this exception. The error code can be any user-defined value. | |
HelpLink | (Inherited from Exception.) | |
HResult | (Inherited from Exception.) | |
InnerException | (Inherited from Exception.) | |
Message | (Inherited from Exception.) | |
Source | (Inherited from Exception.) | |
StackTrace | Gets the stack trace of the exception. (Overrides Exception.StackTrace.) | |
Status | Gets or sets the status code for this exception. | |
TargetSite | (Inherited from Exception.) |
Top
Methods
Name | Description | |
---|---|---|
Equals | (Inherited from Object.) | |
Finalize | (Inherited from Object.) | |
GetBaseException | (Inherited from Exception.) | |
GetHashCode | (Inherited from Object.) | |
GetObjectData | (Inherited from Exception.) | |
GetType | (Inherited from Exception.) | |
MemberwiseClone | (Inherited from Object.) | |
ToString | (Inherited from Exception.) |
Top
Examples
Partial Public Class MainPage
Inherits UserControl
' Create a CustomerDomainContext for the CustomerDomainService
Private _customerContext As CustomerDomainContext
Public Function MainPage()
InitializeComponent()
' Create an EntityQuery of type Customer
Dim query As EntityQuery(Of Customer) = _
From c In _customerContext.GetCustomersQuery() _
Where (c.Phone.StartsWith("583")())() _
Order By (c.LastName) _
Select c()
' Create and execute a LoadOperation of type Customer and load 'query'
Dim loadOp As LoadOperation = Me._customerContext.Load(query)
' Create a new DomainOperationException for a Validation Error
Dim opEx As DomainOperationException = New DomainOperationException( _
"Validation Error", _
OperationErrorStatus.ValidationError, _
9466)
' Check if there are any ValidationErrors when loadOp was executed
' Then throw the DomainOperationException opEx
If loadOp.ValidationErrors <> Empty Then
Throw opEx
End If
' Populate the CustomerGrid with the Entities in loadOp
CustomerGrid.ItemsSource = loadOp.Entities
End Function
End Class
public partial class MainPage : UserControl
{
// Create a CustomerDomainContext for the CustomerDomainService
private CustomerDomainContext _customerContext = new CustomerDomainContext();
public MainPage()
{
InitializeComponent();
// Create an EntityQuery of type Customer
EntityQuery<Customer> query =
from c in _customerContext.GetCustomersQuery()
where c.Phone.StartsWith("583")
orderby c.LastName
select c;
// Create and execute a LoadOperation of type Customer and load 'query'
LoadOperation<Customer> loadOp = this._customerContext.Load(query);
// Create a new DomainOperationException for a Validation Error
DomainOperationException opEx = new DomainOperationException(
"Validation Error",
OperationErrorStatus.ValidationFailed,
0x000024FA);
// Check if there are any ValidationErrors when loadOp was executed
// Then throw the DomainOperationException opEx
if (loadOp.ValidationErrors != null)
{
throw opEx;
}
// Populate the CustomerGrid with the Entities in loadOp
CustomerGrid.ItemsSource = loadOp.Entities;
}
}
Thread Safety
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.