Unverified Commit e591d44e authored by Kaizen 365's avatar Kaizen 365 Committed by GitHub
Browse files

Updated to Blazor 3.2.0-preview2.20160.5, Asp.net core 3.1.2 and Entity Framework 3.1.2. (#216)

parent 518cd642
<Project>
<PropertyGroup>
<AspNetCoreVersion>3.1.0</AspNetCoreVersion>
<BlazorVersion>3.1.0-preview4.19579.2</BlazorVersion>
<EntityFrameworkVersion>3.1.0</EntityFrameworkVersion>
<AspNetCoreVersion>3.1.2</AspNetCoreVersion>
<BlazorVersion>3.2.0-preview2.20160.5</BlazorVersion>
<EntityFrameworkVersion>3.1.2</EntityFrameworkVersion>
</PropertyGroup>
</Project>
......@@ -12,12 +12,17 @@ We're going to fix this bug by introducing something we've dubbed the *AppState
## Getting started
Create a new class called `OrderState` in the Client Project root directory - and register it as a scoped service in the DI container. Much like an ASP.NET Core method, a Blazor application has a `Startup` class and a `ConfigureServices` method. Add the service in `Startup.cs`.
Create a new class called `OrderState` in the Client Project root directory - and register it as a scoped service in the DI container. In Blazor WebAssembly applications, services are registered in the `Program` class via the `Main` method. Add the service just before the call to `await builder.Build().RunAsync();`.
```C#
public void ConfigureServices(IServiceCollection services)
public static async Task Main(string[] args)
{
services.AddScoped<OrderState>();
var builder = WebAssemblyHostBuilder.CreateDefault(args);
builder.RootComponents.Add<App>("app");
builder.Services.AddScoped<OrderState>();
await builder.Build().RunAsync();
}
```
......
......@@ -56,16 +56,22 @@ namespace BlazingPizza.Client
}
```
... then register this as a DI service in `Startup.cs`:
... then register this as a DI service in `Program.cs`:
```cs
public void ConfigureServices(IServiceCollection services)
public static async Task Main(string[] args)
{
services.AddScoped<OrderState>();
var builder = WebAssemblyHostBuilder.CreateDefault(args);
builder.RootComponents.Add<App>("app");
builder.Services.AddScoped<OrderState>();
// Add auth services
services.AddAuthorizationCore();
services.AddScoped<AuthenticationStateProvider, ServerAuthenticationStateProvider>();
builder.Services.AddAuthorizationCore();
builder.Services.AddScoped<AuthenticationStateProvider, ServerAuthenticationStateProvider>();
await builder.Build().RunAsync();
}
```
......
using Microsoft.AspNetCore.Blazor.Hosting;
using System.Threading.Tasks;
namespace BlazingPizza.Client
{
public class Program
{
public static void Main(string[] args)
public static async Task Main(string[] args)
{
CreateHostBuilder(args).Build().Run();
}
var builder = WebAssemblyHostBuilder.CreateDefault(args);
builder.RootComponents.Add<App>("app");
public static IWebAssemblyHostBuilder CreateHostBuilder(string[] args) =>
BlazorWebAssemblyHost.CreateDefaultBuilder()
.UseBlazorStartup<Startup>();
await builder.Build().RunAsync();
}
}
}
using Microsoft.AspNetCore.Components.Builder;
using Microsoft.Extensions.DependencyInjection;
namespace BlazingPizza.Client
{
public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
}
public void Configure(IComponentsApplicationBuilder app)
{
app.AddComponent<App>("app");
}
}
}
......@@ -68,12 +68,12 @@ namespace BlazingPizza.Server
app.UseAuthentication();
app.UseAuthorization();
app.UseClientSideBlazorFiles<Client.Startup>();
app.UseClientSideBlazorFiles<Client.Program>();
app.UseEndpoints(endpoints =>
{
endpoints.MapControllers();
endpoints.MapFallbackToClientSideBlazor<Client.Startup>("index.html");
endpoints.MapFallbackToClientSideBlazor<Client.Program>("index.html");
});
}
}
......
using Microsoft.AspNetCore.Blazor.Hosting;
using System.Threading.Tasks;
namespace BlazingPizza.Client
{
public class Program
{
public static void Main(string[] args)
public static async Task Main(string[] args)
{
CreateHostBuilder(args).Build().Run();
}
var builder = WebAssemblyHostBuilder.CreateDefault(args);
builder.RootComponents.Add<App>("app");
public static IWebAssemblyHostBuilder CreateHostBuilder(string[] args) =>
BlazorWebAssemblyHost.CreateDefaultBuilder()
.UseBlazorStartup<Startup>();
await builder.Build().RunAsync();
}
}
}
using Microsoft.AspNetCore.Components.Builder;
using Microsoft.Extensions.DependencyInjection;
namespace BlazingPizza.Client
{
public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
}
public void Configure(IComponentsApplicationBuilder app)
{
app.AddComponent<App>("app");
}
}
}
......@@ -68,12 +68,12 @@ namespace BlazingPizza.Server
app.UseAuthentication();
app.UseAuthorization();
app.UseClientSideBlazorFiles<Client.Startup>();
app.UseClientSideBlazorFiles<Client.Program>();
app.UseEndpoints(endpoints =>
{
endpoints.MapControllers();
endpoints.MapFallbackToClientSideBlazor<Client.Startup>("index.html");
endpoints.MapFallbackToClientSideBlazor<Client.Program>("index.html");
});
}
}
......
using Microsoft.AspNetCore.Blazor.Hosting;
using System.Threading.Tasks;
namespace BlazingPizza.Client
{
public class Program
{
public static void Main(string[] args)
public static async Task Main(string[] args)
{
CreateHostBuilder(args).Build().Run();
}
var builder = WebAssemblyHostBuilder.CreateDefault(args);
builder.RootComponents.Add<App>("app");
public static IWebAssemblyHostBuilder CreateHostBuilder(string[] args) =>
BlazorWebAssemblyHost.CreateDefaultBuilder()
.UseBlazorStartup<Startup>();
await builder.Build().RunAsync();
}
}
}
using Microsoft.AspNetCore.Components.Builder;
using Microsoft.Extensions.DependencyInjection;
namespace BlazingPizza.Client
{
public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
}
public void Configure(IComponentsApplicationBuilder app)
{
app.AddComponent<App>("app");
}
}
}
......@@ -68,12 +68,12 @@ namespace BlazingPizza.Server
app.UseAuthentication();
app.UseAuthorization();
app.UseClientSideBlazorFiles<Client.Startup>();
app.UseClientSideBlazorFiles<Client.Program>();
app.UseEndpoints(endpoints =>
{
endpoints.MapControllers();
endpoints.MapFallbackToClientSideBlazor<Client.Startup>("index.html");
endpoints.MapFallbackToClientSideBlazor<Client.Program>("index.html");
});
}
}
......
using Microsoft.AspNetCore.Blazor.Hosting;
using System.Threading.Tasks;
namespace BlazingPizza.Client
{
public class Program
{
public static void Main(string[] args)
public static async Task Main(string[] args)
{
CreateHostBuilder(args).Build().Run();
}
var builder = WebAssemblyHostBuilder.CreateDefault(args);
builder.RootComponents.Add<App>("app");
public static IWebAssemblyHostBuilder CreateHostBuilder(string[] args) =>
BlazorWebAssemblyHost.CreateDefaultBuilder()
.UseBlazorStartup<Startup>();
await builder.Build().RunAsync();
}
}
}
using Microsoft.AspNetCore.Components.Builder;
using Microsoft.Extensions.DependencyInjection;
namespace BlazingPizza.Client
{
public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
}
public void Configure(IComponentsApplicationBuilder app)
{
app.AddComponent<App>("app");
}
}
}
......@@ -68,12 +68,12 @@ namespace BlazingPizza.Server
app.UseAuthentication();
app.UseAuthorization();
app.UseClientSideBlazorFiles<Client.Startup>();
app.UseClientSideBlazorFiles<Client.Program>();
app.UseEndpoints(endpoints =>
{
endpoints.MapControllers();
endpoints.MapFallbackToClientSideBlazor<Client.Startup>("index.html");
endpoints.MapFallbackToClientSideBlazor<Client.Program>("index.html");
});
}
}
......
using Microsoft.AspNetCore.Blazor.Hosting;
using Microsoft.Extensions.DependencyInjection;
using System.Threading.Tasks;
namespace BlazingPizza.Client
{
public class Program
{
public static void Main(string[] args)
public static async Task Main(string[] args)
{
CreateHostBuilder(args).Build().Run();
}
var builder = WebAssemblyHostBuilder.CreateDefault(args);
builder.RootComponents.Add<App>("app");
builder.Services.AddScoped<OrderState>();
public static IWebAssemblyHostBuilder CreateHostBuilder(string[] args) =>
BlazorWebAssemblyHost.CreateDefaultBuilder()
.UseBlazorStartup<Startup>();
await builder.Build().RunAsync();
}
}
}
using Microsoft.AspNetCore.Components.Builder;
using Microsoft.Extensions.DependencyInjection;
namespace BlazingPizza.Client
{
public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
services.AddScoped<OrderState>();
}
public void Configure(IComponentsApplicationBuilder app)
{
app.AddComponent<App>("app");
}
}
}
......@@ -68,12 +68,12 @@ namespace BlazingPizza.Server
app.UseAuthentication();
app.UseAuthorization();
app.UseClientSideBlazorFiles<Client.Startup>();
app.UseClientSideBlazorFiles<Client.Program>();
app.UseEndpoints(endpoints =>
{
endpoints.MapControllers();
endpoints.MapFallbackToClientSideBlazor<Client.Startup>("index.html");
endpoints.MapFallbackToClientSideBlazor<Client.Program>("index.html");
});
}
}
......
using Microsoft.AspNetCore.Blazor.Hosting;
using Microsoft.Extensions.DependencyInjection;
using System.Threading.Tasks;
namespace BlazingPizza.Client
{
public class Program
{
public static void Main(string[] args)
public static async Task Main(string[] args)
{
CreateHostBuilder(args).Build().Run();
}
var builder = WebAssemblyHostBuilder.CreateDefault(args);
builder.RootComponents.Add<App>("app");
builder.Services.AddScoped<OrderState>();
public static IWebAssemblyHostBuilder CreateHostBuilder(string[] args) =>
BlazorWebAssemblyHost.CreateDefaultBuilder()
.UseBlazorStartup<Startup>();
await builder.Build().RunAsync();
}
}
}
using Microsoft.AspNetCore.Components.Builder;
using Microsoft.Extensions.DependencyInjection;
namespace BlazingPizza.Client
{
public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
services.AddScoped<OrderState>();
}
public void Configure(IComponentsApplicationBuilder app)
{
app.AddComponent<App>("app");
}
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment