コード例 #1
0
 /// <summary>
 /// Extension method to perform sync/async version of DataServiceContext.GetReadStream dynamically
 /// </summary>
 /// <param name="context">The context to call get read stream on</param>
 /// <param name="continuation">The asynchronous continuation</param>
 /// <param name="async">A value indicating whether or not to use async API</param>
 /// <param name="entity">The entity to get the read stream for</param>
 /// <param name="streamName">The name of the stream or null to indicate the default stream</param>
 /// <param name="args">The wrapped args to the request</param>
 /// <param name="onCompletion">A callback for when the call completes</param>
 public static void GetReadStream(this WrappedDataServiceContext context, IAsyncContinuation continuation, bool async, WrappedEntityInstance entity, string streamName, WrappedObject args, Action <WrappedDataServiceStreamResponse> onCompletion)
 {
     ExceptionUtilities.CheckArgumentNotNull(context, "context");
     if (streamName == null)
     {
         AsyncHelpers.InvokeSyncOrAsyncMethodCall <WrappedDataServiceStreamResponse>(continuation, async, () => context.GetReadStream(entity, args), c => context.BeginGetReadStream(entity, args, c, null), r => context.EndGetReadStream(r), onCompletion);
     }
     else
     {
         AsyncHelpers.InvokeSyncOrAsyncMethodCall <WrappedDataServiceStreamResponse>(continuation, async, () => context.GetReadStream(entity, streamName, args), c => context.BeginGetReadStream(entity, streamName, args, c, null), r => context.EndGetReadStream(r), onCompletion);
     }
 }
コード例 #2
0
 /// <summary>
 /// Extension method to perform sync/async version of DataServiceContext.LoadProperty dynamically
 /// </summary>
 /// <param name="context">The context to call call load property on</param>
 /// <param name="continuation">The asynchronous continuation</param>
 /// <param name="async">A value indicating whether or not to use async API</param>
 /// <param name="entity">The entity to load a property on</param>
 /// <param name="propertyName">The name of the property to load</param>
 /// <param name="onCompletion">A callback for when the call completes</param>
 public static void LoadProperty(this WrappedDataServiceContext context, IAsyncContinuation continuation, bool async, WrappedEntityInstance entity, string propertyName, Action <WrappedQueryOperationResponse> onCompletion)
 {
     ExceptionUtilities.CheckArgumentNotNull(context, "context");
     AsyncHelpers.InvokeSyncOrAsyncMethodCall <WrappedQueryOperationResponse>(continuation, async, () => context.LoadProperty(entity, propertyName), c => context.BeginLoadProperty(entity, propertyName, c, null), r => context.EndLoadProperty(r), onCompletion);
 }