示例#1
0
        private async Task ImportDataSource(SsrsDataSource item)
        {
            var definition = new DataSourceDefinition();

            new SsrsDataSourceDefinitionMapper().MapFromSsrsObject(definition, item);

            var parentPath = await service.GetOrCreateContainer(item.Path, log);

            log.DebugFormat("Importing data source: '{0}'", item.Path);
            try
            {
                await service.Proxy.CreateDataSourceAsync(new CreateDataSourceRequest {
                    TrustedUserHeader = trustedUserHeader,
                    DataSource        = item.Name,
                    Parent            = parentPath,
                    Overwrite         = Overwrite,
                    Definition        = definition
                });
            }
            catch (FaultException)
            {
                if (Overwrite)
                {
                    throw;              // Failure wasn't caused by existence of item.
                }
                if (!await service.ItemExists(item.Path))
                {
                    throw;
                }
            }
        }