/// <summary>
        /// Initializes a new <see cref="WebDomainClientAsyncResult&lt;TContract&gt;"/> instance used for Submit operations.
        /// </summary>
        /// <param name="entityChangeSet">The Submit operation <see cref="EntityChangeSet"/>.</param>
        /// <param name="changeSetEntries">The collection of <see cref="ChangeSetEntry"/>s to submit.</param>
        /// <param name="callback">Optional <see cref="AsyncCallback"/> to invoke upon completion.</param>
        /// <param name="asyncState">Optional user state information that will be passed to the <paramref name="callback"/>.</param>
        /// <exception cref="ArgumentNullException">if <paramref name="domainClient"/> is null.</exception>
        /// <exception cref="ArgumentNullException">if <paramref name="endOperationMethod"/> is null.</exception>
        private WebApiDomainClientAsyncResult(WebApiDomainClient domainClient, EntityChangeSet entityChangeSet, IEnumerable<ChangeSetEntry> changeSetEntries, AsyncCallback callback, object asyncState)
            : base(domainClient, entityChangeSet, callback, asyncState)
        {
            // base class validates domainClient

            _interfaceType = domainClient.ServiceInterfaceType;
            _operationName = "SubmitChanges";
            _changeSetEntries = changeSetEntries;
        }
            public BinaryXmlContent(WebApiDomainClient domainClient,
                                    string operationName, IDictionary <string, object> parameters, List <ServiceQueryPart> queryOptions)
            {
                this.domainClient  = domainClient;
                this.operationName = operationName;
                this.parameters    = parameters;
                this.queryOptions  = queryOptions;

                Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("application/msbin1");
            }
        /// <summary>
        /// Initializes a new <see cref="WebDomainClientAsyncResult&lt;TContract&gt;"/> instance used for Invoke operations.
        /// </summary>
        /// <param name="invokeArgs">The arguments to the Invoke operation.</param>
        /// <param name="callback">Optional <see cref="AsyncCallback"/> to invoke upon completion.</param>
        /// <param name="asyncState">Optional user state information that will be passed to the <paramref name="callback"/>.</param>
        /// <exception cref="ArgumentNullException">if <paramref name="domainClient"/> is null.</exception>
        /// <exception cref="ArgumentNullException">if <paramref name="endOperationMethod"/> is null.</exception>
        private WebApiDomainClientAsyncResult(WebApiDomainClient domainClient, InvokeArgs invokeArgs, AsyncCallback callback, object asyncState)
            : base(domainClient, invokeArgs, callback, asyncState)
        {
            // base class validates domainClient
            if (invokeArgs == null)
                throw new ArgumentNullException("invokeArgs");

            _interfaceType = domainClient.ServiceInterfaceType;
            _operationName = invokeArgs.OperationName;
        }
        /// <summary>
        /// Initializes a new <see cref="WebDomainClientAsyncResult&lt;TContract&gt;"/> instance used for Query operations.
        /// </summary>
        /// <param name="callback">Optional <see cref="AsyncCallback"/> to invoke upon completion.</param>
        /// <param name="asyncState">Optional user state information that will be passed to the <paramref name="callback"/>.</param>
        /// <exception cref="ArgumentNullException">if <paramref name="domainClient"/> is null.</exception>
        /// <exception cref="ArgumentNullException">if <paramref name="endOperationMethod"/> is null.</exception>
        private WebApiDomainClientAsyncResult(WebApiDomainClient domainClient, EntityQuery query, AsyncCallback callback, object asyncState)
            : base(domainClient, callback, asyncState)
        {
            // base class validates domainClient
            if (query == null)
                throw new ArgumentNullException("query");

            _interfaceType = domainClient.ServiceInterfaceType;
            _operationName = query.QueryName;
        }
 /// <summary>
 /// Creates a new <see cref="WebDomainClientAsyncResult&lt;TContract&gt;"/> used for Submit operations.
 /// </summary>
 /// <param name="domainClient">The <see cref="WebDomainClient&lt;TContract&gt;"/> associated with this result.</param>
 /// 
 /// <param name="endOperationMethod">The method that completes an asynchronous operation.</param>
 /// <param name="entityChangeSet">The Submit operation <see cref="EntityChangeSet"/>.</param>
 /// <param name="changeSetEntries">The collection of <see cref="ChangeSetEntry"/>s to submit.</param>
 /// <param name="callback">The <see cref="AsyncCallback"/> to invoke upon completion.</param>
 /// <param name="asyncState">Optional user state information that will be passed to the <paramref name="callback"/>.</param>
 /// <returns>A <see cref="WebDomainClientAsyncResult&lt;TContract&gt;"/> used for Submit operations</returns>
 public static WebApiDomainClientAsyncResult CreateSubmitResult(WebApiDomainClient domainClient, EntityChangeSet entityChangeSet, IEnumerable<ChangeSetEntry> changeSetEntries, AsyncCallback callback, object asyncState)
 {
     return new WebApiDomainClientAsyncResult(domainClient, entityChangeSet, changeSetEntries, callback, asyncState);
 }
 /// <summary>
 /// Creates a new <see cref="WebDomainClientAsyncResult&lt;TContract&gt;"/> used for Query operations.
 /// </summary>
 /// <param name="domainClient">The <see cref="WebDomainClient&lt;TContract&gt;"/> associated with this result.</param>
 /// 
 /// <param name="endOperationMethod">The method that completes an asynchronous operation.</param>
 /// <param name="callback">The <see cref="AsyncCallback"/> to invoke upon completion.</param>
 /// <param name="asyncState">Optional user state information that will be passed to the <paramref name="callback"/>.</param>
 /// <returns>A <see cref="WebDomainClientAsyncResult&lt;TContract&gt;"/> used for Query operations</returns>
 public static WebApiDomainClientAsyncResult CreateQueryResult(WebApiDomainClient domainClient, EntityQuery query, AsyncCallback callback, object asyncState)
 {
     return new WebApiDomainClientAsyncResult(domainClient, query, callback, asyncState);
 }
 /// <summary>
 /// Creates a new <see cref="WebDomainClientAsyncResult&lt;TContract&gt;"/> used for Invoke operations.
 /// </summary>
 /// <param name="domainClient">The <see cref="WebDomainClient&lt;TContract&gt;"/> associated with this result.</param>
 /// 
 /// <param name="endOperationMethod">The method that completes an asynchronous operation.</param>
 /// <param name="invokeArgs">The arguments to the Invoke operation.</param>
 /// <param name="callback">The <see cref="AsyncCallback"/> to invoke upon completion.</param>
 /// <param name="asyncState">Optional user state information that will be passed to the <paramref name="callback"/>.</param>
 /// <returns>A <see cref="WebDomainClientAsyncResult&lt;TContract&gt;"/> used for Invoke operations</returns>
 public static WebApiDomainClientAsyncResult CreateInvokeResult(WebApiDomainClient domainClient, InvokeArgs invokeArgs, AsyncCallback callback, object asyncState)
 {
     return new WebApiDomainClientAsyncResult(domainClient, invokeArgs, callback, asyncState);
 }