Esempio n. 1
0
        // This method gets called by the runtime. Use this method to add services to the container.
        // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
        public void ConfigureServices(IServiceCollection services)
        {
            #if DEBUG
            services.AddServerSideBlazor().AddCircuitOptions(options => { options.DetailedErrors = true; });
            #endif

            services.AddRazorPages();
            services.AddServerSideBlazor();
            services.AddScoped <WeatherForecastService>();
            services.AddDbContext <FMRDemoContext>(options =>
                                                   options.UseSqlServer(Configuration.GetConnectionString("GridLargeDataConnectionString"), opt => opt.UseRowNumberForPaging()));
            services.AddDbContext <ContosoRetailContext>(options =>
                                                         options.UseSqlServer(Configuration.GetConnectionString("PivotGridLargeDataConnectionString")));

            services.Configure <DemoConfiguration>(Configuration.GetSection("DemoConfiguration"));
            services.AddTransient <ProductService>();
            services.AddSingleton <FlatProductService>();
            services.AddSingleton <CountryNamesService>();
            services.AddSalesViewerService();
            services.AddDocumentMetadata((serviceProvider, registrator) =>
            {
                DemoConfiguration config = serviceProvider.GetService <IOptions <DemoConfiguration> >().Value;
                config.RegisterPagesMetadata(registrator);
            });
        }
Esempio n. 2
0
        // This method gets called by the runtime. Use this method to add services to the container.
        // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddMvc();
            services.AddResponseCompression(opts =>
            {
                opts.MimeTypes = ResponseCompressionDefaults.MimeTypes.Concat(
                    new[] { "application/octet-stream" });
            });

            services.AddScoped <WeatherForecastService>();
            services.AddDbContext <FMRDemoContext>(options =>
                                                   options.UseSqlServer("YOUR CONNECTION STRING HERE", opt => opt.UseRowNumberForPaging()));
            services.AddDbContext <ContosoRetailContext>(options =>
                                                         options.UseSqlServer("YOUR CONNECTION STRING HERE"));

            services.AddSingleton <IOptions <DemoConfiguration>, ClientSideDemoConfiguration>();
            services.AddTransient <ProductService>();
            services.AddSingleton <CountryNamesService>();

            services.AddDocumentMetadata((serviceProvider, registrator) =>
            {
                DemoConfiguration config = serviceProvider.GetService <IOptions <DemoConfiguration> >().Value;
                config.RegisterPagesMetadata(registrator);
            });
        }
Esempio n. 3
0
        // This method gets called by the runtime. Use this method to add services to the container.
        // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
        public void ConfigureServices(IServiceCollection services)
        {
#if DEBUG
            services.AddServerSideBlazor().AddCircuitOptions(options => { options.DetailedErrors = true; });
#endif

            services.AddRazorPages();
            services.AddServerSideBlazor();
            services.AddScoped <WeatherForecastService>();
            services.AddDbContext <FMRDemoContext>(options =>
                                                   options.UseSqlServer(Configuration.GetConnectionString("GridLargeDataConnectionString"), opt => opt.UseRowNumberForPaging()));
            services.AddDbContext <ContosoRetailContext>(options =>
                                                         options.UseSqlServer(Configuration.GetConnectionString("PivotGridLargeDataConnectionString")));

            services.Configure <DemoConfiguration>(Configuration.GetSection("DemoConfiguration"));
            services.AddTransient <ProductService>();
            services.AddSingleton <FlatProductService>();
            services.AddSingleton <CountryNamesService>();
            services.AddSalesViewerService();
            services.AddDocumentMetadata((serviceProvider, registrator) => {
                DemoConfiguration config = serviceProvider.GetService <IOptions <DemoConfiguration> >().Value;
                config.RegisterPagesMetadata(registrator);
            });
            services.AddHttpClient();
            services.AddScoped <HttpClient>((sp) => {
                var httpClient = sp.GetService <IHttpClientFactory>().CreateClient();
                httpClient.DefaultRequestHeaders.Add("Accept", "application/json");
                return(httpClient);
            });

            services.AddDevExpressBlazor();
        }
Esempio n. 4
0
        public static async Task Main(string[] args)
        {
            var builder = WebAssemblyHostBuilder.CreateDefault(args);

            builder.Services.AddDevExpressBlazor();
            builder.Services.AddScoped <WeatherForecastService>();
            builder.Services.AddSingleton <IOptions <DemoConfiguration>, ClientSideDemoConfiguration>();
            builder.Services.AddDbContext <FMRDemoContext>(options =>
                                                           options.UseSqlServer("YOUR CONNECTION STRING HERE", opt => opt.UseRowNumberForPaging()));
            builder.Services.AddDbContext <ContosoRetailContext>(options =>
                                                                 options.UseSqlServer("YOUR CONNECTION STRING HERE"));

            builder.Services.AddTransient <ProductService>();
            builder.Services.AddSingleton <FlatProductService>();
            builder.Services.AddTransient <EmployeeService>();
            builder.Services.AddSingleton <CountryNamesService>();
            builder.Services.AddSalesViewerService();
            builder.Services.AddDocumentMetadata((serviceProvider, registrator) =>
            {
                DemoConfiguration config = serviceProvider.GetService <IOptions <DemoConfiguration> >().Value;
                config.RegisterPagesMetadata(registrator);
            });

            builder.RootComponents.Add <App>("app");
            builder.RootComponents.Add <DocumentMetadataComponent>("head");

            await builder.Build().RunAsync();
        }
Esempio n. 5
0
        // This method gets called by the runtime. Use this method to add services to the container.
        // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
        public void ConfigureServices(IServiceCollection services)
        {
#if DEBUG
            services.AddServerSideBlazor().AddCircuitOptions(options => { options.DetailedErrors = true; });
#endif

            services.AddMvc(options => options.EnableEndpointRouting = false)
            .SetCompatibilityVersion(CompatibilityVersion.Version_3_0);

            services.AddRazorPages();
            services.AddServerSideBlazor();

            services.Configure <DemoConfiguration>(Configuration.GetSection("DemoConfiguration"));

            services.AddDocumentMetadata((serviceProvider, registrator) => {
                DemoConfiguration config = serviceProvider.GetService <IOptions <DemoConfiguration> >().Value;
                config.RegisterPagesMetadata(registrator);
            });
            services.AddHttpClient();
            services.AddScoped <HttpClient>((sp) => {
                var httpClient = sp.GetService <IHttpClientFactory>().CreateClient();
                httpClient.DefaultRequestHeaders.Add("Accept", "application/json");
                return(httpClient);
            });

            services.AddDevExpressBlazor();
        }
Esempio n. 6
0
        // This method gets called by the runtime. Use this method to add services to the container.
        // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddDbContext <ApplicationDbContext>(options =>
                                                         options.UseSqlServer(
                                                             Configuration["DBConnectionString"]));
            services.AddDefaultIdentity <IdentityUser>(options => options.SignIn.RequireConfirmedAccount = true)
            .AddEntityFrameworkStores <ApplicationDbContext>();
            services.AddRazorPages();
            services.AddServerSideBlazor();
            services.AddScoped <AuthenticationStateProvider, RevalidatingIdentityAuthenticationStateProvider <IdentityUser> >();
            services.AddSingleton <WeatherForecastService>();

            services.AddDocumentMetadata((serviceProvider, registrator) => {
                DemoConfiguration config = serviceProvider.GetService <IOptions <DemoConfiguration> >().Value;
                config.RegisterPagesMetadata(registrator);
            });

            services.AddHttpClient();
            services.AddScoped <HttpClient>((sp) => {
                var httpClient = sp.GetService <IHttpClientFactory>().CreateClient();
                httpClient.DefaultRequestHeaders.Add("Accept", "application/json");
                return(httpClient);
            });

            /* 3-1 */
            services.AddDevExpressBlazor();
        }
Esempio n. 7
0
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddScoped <WeatherForecastService>();
            services.AddSingleton <IOptions <DemoConfiguration>, ClientSideDemoConfiguration>();
            services.AddDbContext <FMRDemoContext>(options =>
                                                   options.UseSqlServer("YOUR CONNECTION STRING HERE", opt => opt.UseRowNumberForPaging()));
            services.AddDbContext <ContosoRetailContext>(options =>
                                                         options.UseSqlServer("YOUR CONNECTION STRING HERE"));

            services.AddTransient <ProductService>();
            services.AddSingleton <FlatProductService>();
            services.AddSingleton <CountryNamesService>();
            services.AddDocumentMetadata((serviceProvider, registrator) =>
            {
                DemoConfiguration config = serviceProvider.GetService <IOptions <DemoConfiguration> >().Value;
                config.RegisterPagesMetadata(registrator);
            });
        }