Server-side Blazor template cleanups for Preview 4 (#9025)
* Rename Host.cshtml to _Host.cshtml * In Startup.cs, specify root component and selector explicitly so you can easily disable prerendering if desired * Remove unneccesary dependency on NewtonsoftJson package * Remove unnecessary MapRazorPages and make blank lines consistent * Rename "Services" subdirectory to "Data" * Remove favicon.ico (no longer needed since we switched to MapFallbackToPage * Revert MapComponentHub change due to reasons
This commit is contained in:
parent
edb91d0f4d
commit
3657a429eb
|
|
@ -10,7 +10,6 @@
|
|||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Components.Prerendering" Version="${MicrosoftAspNetCoreMvcComponentsPrerenderingPackageVersion}" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="${MicrosoftAspNetCoreMvcNewtonsoftJsonPackageVersion}" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
using System;
|
||||
|
||||
namespace RazorComponentsWeb_CSharp.Services
|
||||
namespace RazorComponentsWeb_CSharp.Data
|
||||
{
|
||||
public class WeatherForecast
|
||||
{
|
||||
|
|
@ -2,7 +2,7 @@ using System;
|
|||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace RazorComponentsWeb_CSharp.Services
|
||||
namespace RazorComponentsWeb_CSharp.Data
|
||||
{
|
||||
public class WeatherForecastService
|
||||
{
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
@page "/fetchdata"
|
||||
@using RazorComponentsWeb_CSharp.Services
|
||||
@using RazorComponentsWeb_CSharp.Data
|
||||
@inject WeatherForecastService ForecastService
|
||||
|
||||
<h1>Weather forecast</h1>
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ using Microsoft.AspNetCore.HttpsPolicy;
|
|||
#endif
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using RazorComponentsWeb_CSharp.Services;
|
||||
using RazorComponentsWeb_CSharp.Data;
|
||||
|
||||
namespace RazorComponentsWeb_CSharp
|
||||
{
|
||||
|
|
@ -20,11 +20,8 @@ namespace RazorComponentsWeb_CSharp
|
|||
// For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
|
||||
public void ConfigureServices(IServiceCollection services)
|
||||
{
|
||||
services.AddRazorPages()
|
||||
.AddNewtonsoftJson();
|
||||
|
||||
services.AddRazorPages();
|
||||
services.AddRazorComponents();
|
||||
|
||||
services.AddSingleton<WeatherForecastService>();
|
||||
}
|
||||
|
||||
|
|
@ -45,6 +42,7 @@ namespace RazorComponentsWeb_CSharp
|
|||
|
||||
#if (RequiresHttps)
|
||||
app.UseHttpsRedirection();
|
||||
|
||||
#endif
|
||||
app.UseStaticFiles();
|
||||
|
||||
|
|
@ -52,9 +50,8 @@ namespace RazorComponentsWeb_CSharp
|
|||
|
||||
app.UseEndpoints(endpoints =>
|
||||
{
|
||||
endpoints.MapRazorPages();
|
||||
endpoints.MapComponentHub();
|
||||
endpoints.MapFallbackToPage("/Host");
|
||||
endpoints.MapFallbackToPage("/_Host");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Binary file not shown.
|
Before Width: | Height: | Size: 31 KiB |
Loading…
Reference in New Issue