예제 #1
0
        public void Configure(IComponentsApplicationBuilder app, IStoreBuilder <AppState> RealmStoreBuilder)
        {
            RealmStoreBuilder.UseRealmAsync <AppState>();

            RealmStoreBuilder.UseRealmReduxDevTools <AppState>(new System.Type[]
            {
                typeof(Redux.Actions.Counter.Dispose)
            });

            //app.Map("/services", builder => builder.Run(async context =>
            //{
            //var sb = new StringBuilder();
            //sb.Append("<h1>All Services</h1>");
            //sb.Append("<table><thead>");
            //sb.Append("<tr><th>Type</th><th>Lifetime</th><th>Instance</th></tr>");
            //sb.Append("</thead><tbody>");
            Console.WriteLine("Test");
            foreach (var svc in _services)
            {
                Console.WriteLine($"{svc.ServiceType.FullName} = {svc.ImplementationType?.FullName}");
            }
            //sb.Append("</tbody></table>");
            //await context.Response.WriteAsync(sb.ToString());
            //}));

            app.AddComponent <App>("app");
        }
예제 #2
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IStoreBuilder <AppState> RealmStoreBuilder, IServiceProvider serviceProvider)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseExceptionHandler("/Error");
                // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
                app.UseHsts();
            }

            app.UseHttpsRedirection();
            app.UseStaticFiles();

            app.UseRouting();

            RealmStoreBuilder.UseRealmAsync <AppState>();

            app.Map("/services", builder => builder.Run(async context =>
            {
                var sb = new StringBuilder();
                sb.Append("<h1>All Services</h1>");
                sb.Append("<table><thead>");
                sb.Append("<tr><th>Type</th><th>Lifetime</th><th>Instance</th></tr>");
                sb.Append("</thead><tbody>");
                foreach (var svc in _services)
                {
                    sb.Append("<tr>");
                    sb.Append($"<td>{svc.ServiceType.FullName}</td>");
                    sb.Append($"<td>{svc.Lifetime}</td>");
                    sb.Append($"<td>{svc.ImplementationType?.FullName}</td>");
                    sb.Append("</tr>");
                }
                sb.Append("</tbody></table>");
                await context.Response.WriteAsync(sb.ToString());
            }));

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapBlazorHub();
                endpoints.MapFallbackToPage("/_Host");
            });
        }