DomainOperationException Class

DomainOperationException 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.]

Indicates that at least one error has occurred during the processing of the domain operations on the server.


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

public sealed class DomainOperationException : Exception

The DomainOperationException type exposes the following members.

Public methodDomainOperationException()Initializes a new instance of the DomainOperationException class.
Public methodDomainOperationException(String)Initializes a new instance of the DomainOperationException class with a specified message that describes the error.
Public methodDomainOperationException(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.
Public methodDomainOperationException(String, OperationErrorStatus)Initializes a new instance of the DomainOperationException class with a localized exception message and status.
Public methodDomainOperationException(String, OperationErrorStatus, Int32)Initializes a new instance of the DomainOperationException class with a localized exception message, status and custom error code.
Public methodDomainOperationException(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.

Public propertyData (Inherited from Exception.)
Public propertyErrorCodeGets or sets the custom error code for this exception. The error code can be any user-defined value.
Public propertyHelpLink (Inherited from Exception.)
Protected propertyHResult (Inherited from Exception.)
Public propertyInnerException (Inherited from Exception.)
Public propertyMessage (Inherited from Exception.)
Public propertySource (Inherited from Exception.)
Public propertyStackTraceGets the stack trace of the exception. (Overrides Exception.StackTrace.)
Public propertyStatusGets or sets the status code for this exception.
Public propertyTargetSite (Inherited from Exception.)

Public methodEquals (Inherited from Object.)
Protected methodFinalize (Inherited from Object.)
Public methodGetBaseException (Inherited from Exception.)
Public methodGetHashCode (Inherited from Object.)
Public methodGetObjectData (Inherited from Exception.)
Public methodGetType (Inherited from Exception.)
Protected methodMemberwiseClone (Inherited from Object.)
Public methodToString (Inherited from Exception.)

public partial class MainPage : UserControl
        // Create a CustomerDomainContext for the CustomerDomainService
        private CustomerDomainContext _customerContext = new CustomerDomainContext();

        public MainPage()

            // 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",

            // 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;

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