コード例 #1
0
        /// <summary>
        /// Executes SaveChanges on the specified context and with the default options and verifies the results.
        /// </summary>
        /// <param name="verifier">The verifier to use for verification.</param>
        /// <param name="contextData">The data for the context.</param>
        /// <param name="context">The context to verify SaveChanges on.</param>
        /// <returns>The response from SaveChanges</returns>
        public static DSClient.DataServiceResponse VerifySaveChanges(this ISaveChangesVerifier verifier, DataServiceContextData contextData, DSClient.DataServiceContext context)
        {
            ExceptionUtilities.CheckArgumentNotNull(verifier, "verifier");
            ExceptionUtilities.CheckArgumentNotNull(contextData, "contextData");
            ExceptionUtilities.CheckArgumentNotNull(context, "context");

            return(verifier.VerifySaveChanges(contextData, context, null));
        }
コード例 #2
0
        /// <summary>
        /// Executes SaveChanges on the specified context and with specified options and verifies the results.
        /// </summary>
        /// <param name="verifier">The verifier to use for verification.</param>
        /// <param name="contextData">The data for the context.</param>
        /// <param name="context">The context to verify SaveChanges on.</param>
        /// <param name="options">The options for saving changes.</param>
        /// <returns>The response from SaveChanges</returns>
        public static DSClient.DataServiceResponse VerifySaveChanges(this ISaveChangesVerifier verifier, DataServiceContextData contextData, DSClient.DataServiceContext context, SaveChangesOptions?options)
        {
            ExceptionUtilities.CheckArgumentNotNull(verifier, "verifier");
            ExceptionUtilities.CheckArgumentNotNull(contextData, "contextData");
            ExceptionUtilities.CheckArgumentNotNull(context, "context");

            DSClient.DataServiceResponse response = null;
            SyncHelpers.ExecuteActionAndWait(c1 => verifier.VerifySaveChanges(c1, contextData, context, options, (c2, r) => { response = r; c2.Continue(); }));
            return(response);
        }
コード例 #3
0
        /// <summary>
        /// Executes SaveChanges on the specified context and with specified options and verifies the results.
        /// </summary>
        /// <param name="verifier">The verifier to use for verification.</param>
        /// <param name="contextData">The data for the context.</param>
        /// <param name="context">The context to verify SaveChanges on.</param>
        /// <param name="options">The options for saving changes.</param>
        /// <returns>The response from SaveChanges</returns>
        public static DSClient.DataServiceResponse VerifySaveChanges(this ISaveChangesVerifier verifier, DataServiceContextData contextData, DSClient.DataServiceContext context, SaveChangesOptions? options)
        {
#if SILVERLIGHT
            throw new TaupoNotSupportedException("Not supported in Silverlight");
#else
            ExceptionUtilities.CheckArgumentNotNull(verifier, "verifier");
            ExceptionUtilities.CheckArgumentNotNull(contextData, "contextData");
            ExceptionUtilities.CheckArgumentNotNull(context, "context");

            DSClient.DataServiceResponse response = null;
            SyncHelpers.ExecuteActionAndWait(c1 => verifier.VerifySaveChanges(c1, contextData, context, options, (c2, r) => { response = r; c2.Continue(); }));
            return response;
#endif
        }
コード例 #4
0
        /// <summary>
        /// Executes SaveChanges on the specified context and verifies the results.
        /// </summary>
        /// <param name="verifier">The verifier to use for verification.</param>
        /// <param name="continuation">The asynchronous continuation</param>
        /// <param name="context">The context to verify SaveChanges on.</param>
        /// <param name="options">The options to use, or null for the default</param>
        /// <param name="onCompletion">The callback to call on completion</param>
        public static void VerifySaveChanges(this ISaveChangesVerifier verifier, IAsyncContinuation continuation, WrappedDataServiceContext context, SaveChangesOptions?options, Action <IAsyncContinuation, DSClient.DataServiceResponse> onCompletion)
        {
            DataServiceContextData data = CheckParametersAndGetDataServiceContextData(verifier, context);

            verifier.VerifySaveChanges(continuation, data, (DSClient.DataServiceContext)context.Product, options, onCompletion);
        }
コード例 #5
0
        /// <summary>
        /// Executes SaveChanges on the specified context and with specified options and verifies the results.
        /// </summary>
        /// <param name="verifier">The verifier to use for verification.</param>
        /// <param name="context">The context to verify SaveChanges on.</param>
        /// <param name="options">The options for saving changes.</param>
        /// <returns>The response from SaveChanges</returns>
        public static DSClient.DataServiceResponse VerifySaveChanges(this ISaveChangesVerifier verifier, WrappedDataServiceContext context, SaveChangesOptions options)
        {
            DataServiceContextData data = CheckParametersAndGetDataServiceContextData(verifier, context);

            return(verifier.VerifySaveChanges(data, (DSClient.DataServiceContext)context.Product, options));
        }
コード例 #6
0
        private static DataServiceContextData CheckParametersAndGetDataServiceContextData(ISaveChangesVerifier verifier, WrappedDataServiceContext context)
        {
            ExceptionUtilities.CheckArgumentNotNull(verifier, "verifier");
            ExceptionUtilities.CheckArgumentNotNull(context, "context");

            IDataServiceContextTrackingScope trackingScope = context.Scope as IDataServiceContextTrackingScope;

            ExceptionUtilities.CheckObjectNotNull(trackingScope, "Wrapped data service sontext does not belong to a tracking scope. Cannot obtain DataServiceContextData for verification.");
            return(trackingScope.GetDataServiceContextData(context));
        }
コード例 #7
0
        private static DataServiceContextData CheckParametersAndGetDataServiceContextData(ISaveChangesVerifier verifier, WrappedDataServiceContext context)
        {
            ExceptionUtilities.CheckArgumentNotNull(verifier, "verifier");
            ExceptionUtilities.CheckArgumentNotNull(context, "context");

            IDataServiceContextTrackingScope trackingScope = context.Scope as IDataServiceContextTrackingScope;
            ExceptionUtilities.CheckObjectNotNull(trackingScope, "Wrapped data service sontext does not belong to a tracking scope. Cannot obtain DataServiceContextData for verification.");
            return trackingScope.GetDataServiceContextData(context);
        }