Esempio n. 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;
                }
            }
        }
Esempio n. 2
0
        public async Task Run(TextWriter output)
        {
            var definition = new DataSourceDefinition();

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

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

            log.InfoFormat("Creating data source: '{0}'", dataSource.Path);
            await service.Proxy.CreateDataSourceAsync(new CreateDataSourceRequest {
                TrustedUserHeader = trustedUserHeader,
                DataSource        = dataSource.Name,
                Parent            = parentPath,
                Overwrite         = Overwrite,
                Definition        = definition
            });
        }