Esempio n. 1
0
        public IJob CreateJob()
        {
            if (String.IsNullOrWhiteSpace(SsrsUriString))
            {
                throw new InvalidArgumentsException("No SSRS URI specified.");
            }
            if (!Uri.TryCreate(SsrsUriString, UriKind.Absolute, out var ssrsUri))
            {
                throw new InvalidArgumentsException($"Not a valid absolute URI: {SsrsUriString}");
            }
            if (String.IsNullOrWhiteSpace(ObjectPath))
            {
                throw new InvalidArgumentsException("No object path specified.");
            }
            if (String.IsNullOrWhiteSpace(ConnectionString))
            {
                throw new InvalidArgumentsException("No connection string specified.");
            }

            ConnectionStringUtils.ValidateArgument <SqlConnectionStringBuilder>(ConnectionString);

            var service    = ReportingServiceClientFactory.CreateFromShorthandUri(ssrsUri);
            var dataSource = BuildDataSource();

            return(new CreateDataSourceJob(service, dataSource)
            {
                Overwrite = Overwrite
            });
        }
Esempio n. 2
0
        private SsrsDataSource ReadDataSource(XDocument xml, string itemName, SsrsObjectPath containerPath)
        {
            var connectionString = new DataSourceXmlSchema().GetConnectionString(xml);

            return(new SsrsDataSource {
                Name = itemName,
                Path = containerPath + itemName,
                ConnectionString = connectionString,
                Authentication = GetAuthenticationType()
            });

            SsrsDataSource.AuthenticationType GetAuthenticationType()
            {
                var credentials        = ConnectionStringUtils.GetNetworkCredentials(connectionString);
                var integratedSecurity = new DataSourceXmlSchema().GetIntegratedSecurity(xml);

                if (credentials != null)
                {
                    return(new SsrsDataSource.AuthenticationType.StoredCredentials {
                        UserName = credentials.UserName,
                        Domain = credentials.Domain,
                        Password = credentials.Password,
                        WindowsCredentials = integratedSecurity
                    });
                }
                if (integratedSecurity)
                {
                    return(new SsrsDataSource.AuthenticationType.WindowsIntegrated());
                }
                return(new SsrsDataSource.AuthenticationType.None());
            }
        }
Esempio n. 3
0
        public override void ConfigureServices(WebHostBuilderContext context, IServiceCollection services)
        {
            services.AddServerSideBlazor();

            var optionsBuilder = services.AddOptions();

            optionsBuilder.AddOptions <SeoConfiguration>("BlazorDemo");


            services.AddScoped <HttpClient>(serviceProvider => serviceProvider.GetService <IHttpClientFactory>().CreateClient());

            services.AddScoped <IContosoRetailDataProvider, ContosoRetailDataProvider>();
            services.AddScoped <IRentInfoDataProvider, RentInfoDataProvider>();

            services.AddDbContext <FMRDemoContext>(options => {
                var connectionString = ConnectionStringUtils.GetGridLargeDataConnectionString(context.Configuration);
                if (connectionString != null)
                {
                    options.UseSqlServer(connectionString);
                }
            });

            services.AddDbContext <ContosoRetailContext>(options => {
                var connectionString = ConnectionStringUtils.GetPivotGridLargeDataConnectionString(context.Configuration);
                if (connectionString != null)
                {
                    options.UseSqlServer(connectionString);
                }
            });
        }
 public override Task <IObservable <int> > GetLoadingStateAsync()
 {
     if (ConnectionStringUtils.GetPivotGridLargeDataConnectionString(Configuration) == null)
     {
         return(Task.FromResult <IObservable <int> >(null));
     }
     return(base.GetLoadingStateAsync());
 }
Esempio n. 5
0
 public IRuntimeDatabaseConfiguration ElevatedRuntimeDatabaseConfiguration()
 {
     return(new RuntimeDatabaseConfiguration(PlatformDatabaseProvider)
     {
         ConnectionString = ConnectionStringUtils.Make(ElevatedAuthenticationCredential, ElevatedUserAuthenticationMode, Server, Catalog, ServicesAdvancedSettings),
         DatabaseUnicodeSupport = Unicode,
     });
 }
Esempio n. 6
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.Configure <CookiePolicyOptions>(options =>
            {
                // This lambda determines whether user consent for non-essential cookies is needed for a given request.
                options.CheckConsentNeeded    = context => true;
                options.MinimumSameSitePolicy = SameSiteMode.None;
            });

            services.AddDbContext <GuestsContext>(options => options.UseSqlServer(ConnectionStringUtils.GetConnectionString()));
            services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);

            services.AddScoped <IGuestsRepository, GuestsRepository>();
        }
Esempio n. 7
0
 public override IRuntimeDatabaseConfiguration RuntimeDatabaseConfiguration(User user)
 {
     return(new RuntimeDatabaseConfiguration(PlatformDatabaseProvider)
     {
         ConnectionString = ConnectionStringUtils.Make(
             user == User.Admin ? AdminAuthenticationCredential : RuntimeAuthenticationCredential,
             AuthenticationMode,
             Server,
             Catalog,
             RuntimeAdvancedSettings
             ),
         DatabaseUnicodeSupport = Unicode
     });
 }
Esempio n. 8
0
 /// <summary>
 /// Configure the dependency injection services
 /// </summary>
 private static IServiceProvider CreateServices()
 {
     return(new ServiceCollection()
            // Add common FluentMigrator services
            .AddFluentMigratorCore()
            .ConfigureRunner(rb => rb
                             // Add SQLite support to FluentMigrator
                             .AddSqlServer2016()
                             // Set the connection string
                             .WithGlobalConnectionString(ConnectionStringUtils.GetDefaultConnectionString())
                             // Define the assembly containing the migrations
                             .ScanIn(typeof(InitMigration).Assembly).For.Migrations())
            // Enable logging to console in the FluentMigrator way
            .AddLogging(lb => lb.AddFluentMigratorConsole())
            // Build the service provider
            .BuildServiceProvider(false));
 }
Esempio n. 9
0
        public static ISessionFactory BuildDefaultSession(this Configuration cfg)
        {
            var mapper = new ModelMapper();

            mapper.AddMappings(Assembly.GetExecutingAssembly().GetExportedTypes());

            HbmMapping mapping = mapper.CompileMappingForAllExplicitlyAddedEntities();

            cfg.AddMapping(mapping);

            cfg.DataBaseIntegration(x =>
            {
                x.ConnectionString = ConnectionStringUtils.GetDefaultConnectionString();

                x.Driver <SqlClientDriver>();
                x.Dialect <MsSql2008Dialect>();
            });

            return(cfg.BuildSessionFactory());
        }
Esempio n. 10
0
        public override void ConfigureServices(WebHostBuilderContext context, IServiceCollection services)
        {
            services.AddNotSupportedDemoServices();

            services.AddDbContextFactory <NorthwindContext>(opt => {
                var connectionString = ConnectionStringUtils.GetNorthwindConnectionString(context.Configuration);
                if (!string.IsNullOrEmpty(connectionString))
                {
                    opt.UseSqlServer(connectionString);
                }
                else
                {
                    opt.UseSqlite(ConnectionStringUtils.GetNorthwindSqliteConnectionString(context.Configuration));
                }
            });
            services.AddDbContextFactory <IssuesContext>(opt => {
                var connectionString = ConnectionStringUtils.GetIssuesConnectionString(context.Configuration);
                if (!string.IsNullOrEmpty(connectionString))
                {
                    opt.UseSqlServer(connectionString);
                }
                else
                {
                    opt.UseSqlite(ConnectionStringUtils.GetIssuesSqliteConnectionString(context.Configuration));
                }
            });
            services.AddDbContextFactory <WorldcitiesContext>(opt => {
                var connectionString = ConnectionStringUtils.GetWorlcitiesConnectionString(context.Configuration);
                if (!string.IsNullOrEmpty(connectionString))
                {
                    opt.UseSqlServer(connectionString);
                }
                else
                {
                    opt.UseSqlite(ConnectionStringUtils.GetWorlcitiesSqliteConnectionString(context.Configuration));
                }
            });
        }
Esempio n. 11
0
        public override void ConfigureServices(WebHostBuilderContext context, IServiceCollection services)
        {
#if DEBUG
            bool detailedErrors = true;
#else
            bool detailedErrors = Configuration.GetValue("detailedErrors", false);
#endif
            services.AddServerSideBlazor().AddCircuitOptions(x => x.DetailedErrors = detailedErrors);

            var optionsBuilder = services.AddOptions();
            optionsBuilder.AddOptions <DemoConfigurationData>("BlazorDemo");

            services.AddDevExpressBlazorWasmMasks();

            services.AddSingleton <IDemoVersion, DemoVersion>(x => {
                string customVersion = Configuration.GetValue <string>("dxversion");
                if (!string.IsNullOrEmpty(customVersion))
                {
                    customVersion = " " + customVersion.TrimStart();
                }
                var dxVersion = new Version(AssemblyInfo.Version);
                return(new DemoVersion(new Version(dxVersion.Major, dxVersion.Minor, dxVersion.Build) + customVersion));
            });
            services.AddScoped <HttpClient>(serviceProvider => serviceProvider.GetService <IHttpClientFactory>().CreateClient());

            services.AddScoped <IContosoRetailDataProvider, ContosoRetailDataProvider>();
            services.AddScoped <IRentInfoDataProvider, RentInfoDataProvider>();

            services.AddDbContextFactory <NorthwindContext>(opt => {
                var connectionString = ConnectionStringUtils.GetNorthwindConnectionString(context.Configuration);
                if (!string.IsNullOrEmpty(connectionString))
                {
                    opt.UseSqlServer(connectionString);
                }
                else
                {
                    opt.UseSqlite(ConnectionStringUtils.GetNorthwindSqliteConnectionString(context.Configuration));
                }
            });
            services.AddDbContextFactory <IssuesContext>(opt => {
                var connectionString = ConnectionStringUtils.GetIssuesConnectionString(context.Configuration);
                if (!string.IsNullOrEmpty(connectionString))
                {
                    opt.UseSqlServer(connectionString);
                }
                else
                {
                    opt.UseSqlite(ConnectionStringUtils.GetIssuesSqliteConnectionString(context.Configuration));
                }
            });
            services.AddDbContextFactory <WorldcitiesContext>(opt => {
                var connectionString = ConnectionStringUtils.GetWorlcitiesConnectionString(context.Configuration);
                if (!string.IsNullOrEmpty(connectionString))
                {
                    opt.UseSqlServer(connectionString);
                }
                else
                {
                    opt.UseSqlite(ConnectionStringUtils.GetWorlcitiesSqliteConnectionString(context.Configuration));
                }
            });
            services.AddDbContextFactory <RentInfoContext>(opt => {
                var connectionString = ConnectionStringUtils.GetGridLargeDataConnectionString(context.Configuration);
                if (!string.IsNullOrEmpty(connectionString))
                {
                    opt.UseSqlServer(connectionString);
                }
            });
            services.AddDbContextFactory <ContosoRetailContext>(opt => {
                var connectionString = ConnectionStringUtils.GetPivotGridLargeDataConnectionString(context.Configuration);
                if (!string.IsNullOrEmpty(connectionString))
                {
                    opt.UseSqlServer(connectionString);
                }
            });
        }