Exemplo n.º 1
0
        public static async Task ExecuteAsync(NetworkCredential credentials, IReportServerConfig config, Func <IReportExecutionContext, Task> task, CancellationToken cancellationToken)
        {
            var client = SoapClientFactory.CreateReportExecutionClient(config);

            client.SetCredentials(credentials);

            await task(new ReportExecutionContext(client)).WithCancellation(cancellationToken);
        }
Exemplo n.º 2
0
        public static Task ExecuteAsync(
            NetworkCredential credentials,
            IReportServerConfig config,
            Func <IReportServerExecutionContext, Task> task,
            CancellationToken cancellationToken)
        {
            var client = SoapClientFactory.CreateReportServiceClient(config);

            client.SetCredentials(credentials);

            using (new OperationContextScope(client.InnerChannel))
            {
                if (client.GetCredentialType() == HttpClientCredentialType.Basic)
                {
                    BasicAuthHelper.SetBasicAuthHeader(credentials);
                }

                var context = new ReportServerExecutionContext(client);

                return(task(context).WithCancellation(cancellationToken));
            }
        }