diff --git a/BlazorApp1/BlazorApp1.csproj b/BlazorApp1/BlazorApp1.csproj
index 00c873a..d1f5f19 100644
--- a/BlazorApp1/BlazorApp1.csproj
+++ b/BlazorApp1/BlazorApp1.csproj
@@ -2,20 +2,18 @@
netstandard2.0
- dotnet
- blazor serve
-
- https://dotnet.myget.org/f/blazor-dev/api/v3/index.json;
-
+ Exe
7.3
+ 3.0
-
-
-
-
-
+
+
+
+
+
+
diff --git a/BlazorApp1/Chat.cshtml b/BlazorApp1/Chat.cshtml
deleted file mode 100644
index 629bc0f..0000000
--- a/BlazorApp1/Chat.cshtml
+++ /dev/null
@@ -1,45 +0,0 @@
-@using Blazor.Extensions;
-
-
Chat
-
-
-
-
- @foreach (var message in messages)
- {
- - @message
- }
-
-
-@functions {
-string message;
-IList messages = new List();
-bool disabled = true;
-HubConnection connection;
-
-protected override async Task OnInitAsync()
-{
- connection = new HubConnectionBuilder().WithUrl("/hubs/chat").Build();
- connection.On("SendAction", this.OnMessage);
- connection.On("SendMessage", this.OnMessage);
- await connection.StartAsync();
- disabled = false;
-}
-
-Task OnMessage(string message)
-{
- messages.Add(message);
- StateHasChanged();
- return Task.CompletedTask;
-}
-
-async Task SendAsync()
-{
- await connection.InvokeAsync("Send", message);
- message = "";
-}
-}
\ No newline at end of file
diff --git a/BlazorApp1/Chat.razor b/BlazorApp1/Chat.razor
new file mode 100644
index 0000000..1616684
--- /dev/null
+++ b/BlazorApp1/Chat.razor
@@ -0,0 +1,52 @@
+@using Blazor.Extensions
+@using Microsoft.AspNetCore.Components.Forms
+@using Microsoft.JSInterop
+@using Microsoft.AspNetCore.Components.Web @* See https://devblogs.microsoft.com/aspnet/asp-net-core-and-blazor-updates-in-net-core-3-0-preview-9/ *@
+
+@inject IJSRuntime jsRuntime
+Chat
+
+
+
+ Say something:
+
+
+
+
+
+ @foreach (var message in messages)
+ {
+ - @message
+ }
+
+
+@code {
+ string message;
+ IList messages = new List();
+ bool disabled = true;
+ HubConnection connection;
+
+ protected override async Task OnInitializedAsync()
+ {
+ connection = new Blazor.Extensions.HubConnectionBuilder(jsRuntime).WithUrl("/hubs/chat").Build();
+ connection.On("SendAction", this.OnMessage);
+ connection.On("SendMessage", this.OnMessage);
+ await connection.StartAsync();
+ disabled = false;
+ }
+
+ Task OnMessage(string message)
+ {
+ messages.Add(message);
+ StateHasChanged();
+ return Task.CompletedTask;
+ }
+
+ async Task SendAsync()
+ {
+ await connection.InvokeAsync("Send", message);
+ message = "";
+ }
+}
\ No newline at end of file
diff --git a/BlazorApp1/Startup.cs b/BlazorApp1/Startup.cs
index 72045f2..cb65004 100644
--- a/BlazorApp1/Startup.cs
+++ b/BlazorApp1/Startup.cs
@@ -1,4 +1,4 @@
-using Microsoft.AspNetCore.Blazor.Builder;
+using Microsoft.AspNetCore.Components.Builder;
using Microsoft.Extensions.DependencyInjection;
namespace BlazorApp1
@@ -9,7 +9,7 @@ public void ConfigureServices(IServiceCollection services)
{
}
- public void Configure(IBlazorApplicationBuilder app)
+ public void Configure(IComponentsApplicationBuilder app)
{
app.AddComponent("chat");
}
diff --git a/WebApplication1/Data/Migrations/20191031061645_initial.Designer.cs b/WebApplication1/Data/Migrations/20191031061645_initial.Designer.cs
new file mode 100644
index 0000000..7eaa5fc
--- /dev/null
+++ b/WebApplication1/Data/Migrations/20191031061645_initial.Designer.cs
@@ -0,0 +1,277 @@
+//
+using System;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Metadata;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+using WebApplication1.Data;
+
+namespace WebApplication1.Data.Migrations
+{
+ [DbContext(typeof(ApplicationDbContext))]
+ [Migration("20191031061645_initial")]
+ partial class initial
+ {
+ protected override void BuildTargetModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder
+ .HasAnnotation("ProductVersion", "3.0.0")
+ .HasAnnotation("Relational:MaxIdentifierLength", 128)
+ .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
+ {
+ b.Property("Id")
+ .HasColumnType("nvarchar(450)");
+
+ b.Property("ConcurrencyStamp")
+ .IsConcurrencyToken()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Name")
+ .HasColumnType("nvarchar(256)")
+ .HasMaxLength(256);
+
+ b.Property("NormalizedName")
+ .HasColumnType("nvarchar(256)")
+ .HasMaxLength(256);
+
+ b.HasKey("Id");
+
+ b.HasIndex("NormalizedName")
+ .IsUnique()
+ .HasName("RoleNameIndex")
+ .HasFilter("[NormalizedName] IS NOT NULL");
+
+ b.ToTable("AspNetRoles");
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int")
+ .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
+
+ b.Property("ClaimType")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("ClaimValue")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("RoleId")
+ .IsRequired()
+ .HasColumnType("nvarchar(450)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("RoleId");
+
+ b.ToTable("AspNetRoleClaims");
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b =>
+ {
+ b.Property("Id")
+ .HasColumnType("nvarchar(450)");
+
+ b.Property("AccessFailedCount")
+ .HasColumnType("int");
+
+ b.Property("ConcurrencyStamp")
+ .IsConcurrencyToken()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Email")
+ .HasColumnType("nvarchar(256)")
+ .HasMaxLength(256);
+
+ b.Property("EmailConfirmed")
+ .HasColumnType("bit");
+
+ b.Property("LockoutEnabled")
+ .HasColumnType("bit");
+
+ b.Property("LockoutEnd")
+ .HasColumnType("datetimeoffset");
+
+ b.Property("NormalizedEmail")
+ .HasColumnType("nvarchar(256)")
+ .HasMaxLength(256);
+
+ b.Property("NormalizedUserName")
+ .HasColumnType("nvarchar(256)")
+ .HasMaxLength(256);
+
+ b.Property("PasswordHash")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("PhoneNumber")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("PhoneNumberConfirmed")
+ .HasColumnType("bit");
+
+ b.Property("SecurityStamp")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("TwoFactorEnabled")
+ .HasColumnType("bit");
+
+ b.Property("UserName")
+ .HasColumnType("nvarchar(256)")
+ .HasMaxLength(256);
+
+ b.HasKey("Id");
+
+ b.HasIndex("NormalizedEmail")
+ .HasName("EmailIndex");
+
+ b.HasIndex("NormalizedUserName")
+ .IsUnique()
+ .HasName("UserNameIndex")
+ .HasFilter("[NormalizedUserName] IS NOT NULL");
+
+ b.ToTable("AspNetUsers");
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int")
+ .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
+
+ b.Property("ClaimType")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("ClaimValue")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("UserId")
+ .IsRequired()
+ .HasColumnType("nvarchar(450)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("UserId");
+
+ b.ToTable("AspNetUserClaims");
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b =>
+ {
+ b.Property("LoginProvider")
+ .HasColumnType("nvarchar(128)")
+ .HasMaxLength(128);
+
+ b.Property("ProviderKey")
+ .HasColumnType("nvarchar(128)")
+ .HasMaxLength(128);
+
+ b.Property("ProviderDisplayName")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("UserId")
+ .IsRequired()
+ .HasColumnType("nvarchar(450)");
+
+ b.HasKey("LoginProvider", "ProviderKey");
+
+ b.HasIndex("UserId");
+
+ b.ToTable("AspNetUserLogins");
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b =>
+ {
+ b.Property("UserId")
+ .HasColumnType("nvarchar(450)");
+
+ b.Property("RoleId")
+ .HasColumnType("nvarchar(450)");
+
+ b.HasKey("UserId", "RoleId");
+
+ b.HasIndex("RoleId");
+
+ b.ToTable("AspNetUserRoles");
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b =>
+ {
+ b.Property("UserId")
+ .HasColumnType("nvarchar(450)");
+
+ b.Property("LoginProvider")
+ .HasColumnType("nvarchar(128)")
+ .HasMaxLength(128);
+
+ b.Property("Name")
+ .HasColumnType("nvarchar(128)")
+ .HasMaxLength(128);
+
+ b.Property("Value")
+ .HasColumnType("nvarchar(max)");
+
+ b.HasKey("UserId", "LoginProvider", "Name");
+
+ b.ToTable("AspNetUserTokens");
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b =>
+ {
+ b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
+ .WithMany()
+ .HasForeignKey("RoleId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b =>
+ {
+ b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null)
+ .WithMany()
+ .HasForeignKey("UserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b =>
+ {
+ b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null)
+ .WithMany()
+ .HasForeignKey("UserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b =>
+ {
+ b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
+ .WithMany()
+ .HasForeignKey("RoleId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null)
+ .WithMany()
+ .HasForeignKey("UserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b =>
+ {
+ b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null)
+ .WithMany()
+ .HasForeignKey("UserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+#pragma warning restore 612, 618
+ }
+ }
+}
diff --git a/WebApplication1/Data/Migrations/20191031061645_initial.cs b/WebApplication1/Data/Migrations/20191031061645_initial.cs
new file mode 100644
index 0000000..d1687f8
--- /dev/null
+++ b/WebApplication1/Data/Migrations/20191031061645_initial.cs
@@ -0,0 +1,17 @@
+using Microsoft.EntityFrameworkCore.Migrations;
+
+namespace WebApplication1.Data.Migrations
+{
+ public partial class initial : Migration
+ {
+ protected override void Up(MigrationBuilder migrationBuilder)
+ {
+
+ }
+
+ protected override void Down(MigrationBuilder migrationBuilder)
+ {
+
+ }
+ }
+}
diff --git a/WebApplication1/Data/Migrations/ApplicationDbContextModelSnapshot.cs b/WebApplication1/Data/Migrations/ApplicationDbContextModelSnapshot.cs
index 9d76418..a392fab 100644
--- a/WebApplication1/Data/Migrations/ApplicationDbContextModelSnapshot.cs
+++ b/WebApplication1/Data/Migrations/ApplicationDbContextModelSnapshot.cs
@@ -1,10 +1,10 @@
-//
+//
using System;
-using WebApplication1.Data;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+using WebApplication1.Data;
namespace WebApplication1.Data.Migrations
{
@@ -15,22 +15,25 @@ protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
- .HasAnnotation("ProductVersion", "2.1.0")
+ .HasAnnotation("ProductVersion", "3.0.0")
.HasAnnotation("Relational:MaxIdentifierLength", 128)
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
{
b.Property("Id")
- .ValueGeneratedOnAdd();
+ .HasColumnType("nvarchar(450)");
b.Property("ConcurrencyStamp")
- .IsConcurrencyToken();
+ .IsConcurrencyToken()
+ .HasColumnType("nvarchar(max)");
b.Property("Name")
+ .HasColumnType("nvarchar(256)")
.HasMaxLength(256);
b.Property("NormalizedName")
+ .HasColumnType("nvarchar(256)")
.HasMaxLength(256);
b.HasKey("Id");
@@ -47,14 +50,18 @@ protected override void BuildModel(ModelBuilder modelBuilder)
{
b.Property("Id")
.ValueGeneratedOnAdd()
+ .HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
- b.Property("ClaimType");
+ b.Property("ClaimType")
+ .HasColumnType("nvarchar(max)");
- b.Property("ClaimValue");
+ b.Property("ClaimValue")
+ .HasColumnType("nvarchar(max)");
b.Property("RoleId")
- .IsRequired();
+ .IsRequired()
+ .HasColumnType("nvarchar(450)");
b.HasKey("Id");
@@ -66,39 +73,53 @@ protected override void BuildModel(ModelBuilder modelBuilder)
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b =>
{
b.Property("Id")
- .ValueGeneratedOnAdd();
+ .HasColumnType("nvarchar(450)");
- b.Property("AccessFailedCount");
+ b.Property("AccessFailedCount")
+ .HasColumnType("int");
b.Property("ConcurrencyStamp")
- .IsConcurrencyToken();
+ .IsConcurrencyToken()
+ .HasColumnType("nvarchar(max)");
b.Property("Email")
+ .HasColumnType("nvarchar(256)")
.HasMaxLength(256);
- b.Property("EmailConfirmed");
+ b.Property("EmailConfirmed")
+ .HasColumnType("bit");
- b.Property("LockoutEnabled");
+ b.Property("LockoutEnabled")
+ .HasColumnType("bit");
- b.Property("LockoutEnd");
+ b.Property("LockoutEnd")
+ .HasColumnType("datetimeoffset");
b.Property("NormalizedEmail")
+ .HasColumnType("nvarchar(256)")
.HasMaxLength(256);
b.Property("NormalizedUserName")
+ .HasColumnType("nvarchar(256)")
.HasMaxLength(256);
- b.Property("PasswordHash");
+ b.Property("PasswordHash")
+ .HasColumnType("nvarchar(max)");
- b.Property("PhoneNumber");
+ b.Property("PhoneNumber")
+ .HasColumnType("nvarchar(max)");
- b.Property("PhoneNumberConfirmed");
+ b.Property("PhoneNumberConfirmed")
+ .HasColumnType("bit");
- b.Property("SecurityStamp");
+ b.Property("SecurityStamp")
+ .HasColumnType("nvarchar(max)");
- b.Property("TwoFactorEnabled");
+ b.Property("TwoFactorEnabled")
+ .HasColumnType("bit");
b.Property("UserName")
+ .HasColumnType("nvarchar(256)")
.HasMaxLength(256);
b.HasKey("Id");
@@ -118,14 +139,18 @@ protected override void BuildModel(ModelBuilder modelBuilder)
{
b.Property("Id")
.ValueGeneratedOnAdd()
+ .HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
- b.Property("ClaimType");
+ b.Property("ClaimType")
+ .HasColumnType("nvarchar(max)");
- b.Property("ClaimValue");
+ b.Property("ClaimValue")
+ .HasColumnType("nvarchar(max)");
b.Property("UserId")
- .IsRequired();
+ .IsRequired()
+ .HasColumnType("nvarchar(450)");
b.HasKey("Id");
@@ -137,15 +162,19 @@ protected override void BuildModel(ModelBuilder modelBuilder)
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b =>
{
b.Property("LoginProvider")
+ .HasColumnType("nvarchar(128)")
.HasMaxLength(128);
b.Property("ProviderKey")
+ .HasColumnType("nvarchar(128)")
.HasMaxLength(128);
- b.Property("ProviderDisplayName");
+ b.Property("ProviderDisplayName")
+ .HasColumnType("nvarchar(max)");
b.Property("UserId")
- .IsRequired();
+ .IsRequired()
+ .HasColumnType("nvarchar(450)");
b.HasKey("LoginProvider", "ProviderKey");
@@ -156,9 +185,11 @@ protected override void BuildModel(ModelBuilder modelBuilder)
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b =>
{
- b.Property("UserId");
+ b.Property("UserId")
+ .HasColumnType("nvarchar(450)");
- b.Property("RoleId");
+ b.Property("RoleId")
+ .HasColumnType("nvarchar(450)");
b.HasKey("UserId", "RoleId");
@@ -169,15 +200,19 @@ protected override void BuildModel(ModelBuilder modelBuilder)
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b =>
{
- b.Property("UserId");
+ b.Property("UserId")
+ .HasColumnType("nvarchar(450)");
b.Property("LoginProvider")
+ .HasColumnType("nvarchar(128)")
.HasMaxLength(128);
b.Property("Name")
+ .HasColumnType("nvarchar(128)")
.HasMaxLength(128);
- b.Property("Value");
+ b.Property("Value")
+ .HasColumnType("nvarchar(max)");
b.HasKey("UserId", "LoginProvider", "Name");
@@ -186,47 +221,53 @@ protected override void BuildModel(ModelBuilder modelBuilder)
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b =>
{
- b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole")
+ b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
.WithMany()
.HasForeignKey("RoleId")
- .OnDelete(DeleteBehavior.Cascade);
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b =>
{
- b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser")
+ b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null)
.WithMany()
.HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade);
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b =>
{
- b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser")
+ b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null)
.WithMany()
.HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade);
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b =>
{
- b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole")
+ b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
.WithMany()
.HasForeignKey("RoleId")
- .OnDelete(DeleteBehavior.Cascade);
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
- b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser")
+ b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null)
.WithMany()
.HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade);
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b =>
{
- b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser")
+ b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null)
.WithMany()
.HasForeignKey("UserId")
- .OnDelete(DeleteBehavior.Cascade);
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
});
#pragma warning restore 612, 618
}
diff --git a/WebApplication1/Startup.cs b/WebApplication1/Startup.cs
index 939329d..7fa8e5b 100644
--- a/WebApplication1/Startup.cs
+++ b/WebApplication1/Startup.cs
@@ -8,11 +8,12 @@
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.HttpsPolicy;
using Microsoft.AspNetCore.Mvc;
-using Microsoft.EntityFrameworkCore;
using WebApplication1.Data;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using WebApplication1.Hubs;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.Extensions.Hosting;
namespace WebApplication1
{
@@ -35,25 +36,27 @@ public void ConfigureServices(IServiceCollection services)
options.MinimumSameSitePolicy = SameSiteMode.None;
});
- services.AddDbContext(options =>
+ services.AddDbContext(options => {
options.UseSqlServer(
- Configuration.GetConnectionString("DefaultConnection")));
+ Configuration.GetConnectionString("DefaultConnection"));
+ });
+
services.AddDefaultIdentity()
.AddEntityFrameworkStores();
- services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);
+ services.AddRazorPages();
services.AddSignalR();
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
- public void Configure(IApplicationBuilder app, IHostingEnvironment env)
+ public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
- app.UseDatabaseErrorPage();
+ //app.UseDatabaseErrorPage();
}
else
{
@@ -63,15 +66,18 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env)
app.UseHttpsRedirection();
app.UseStaticFiles();
+ app.UseClientSideBlazorFiles();
app.UseCookiePolicy();
+ app.UseRouting();
app.UseAuthentication();
+ app.UseAuthorization();
- app.UseMvc();
-
- app.UseSignalR(routes => routes.MapHub("/hubs/chat"));
-
- app.UseBlazor();
+ app.UseEndpoints(ep => {
+ //ep.MapControllerRoute("default", "{controller=Home}/{action=Index}" );
+ ep.MapRazorPages();
+ ep.MapHub("/hubs/chat");
+ });
}
}
}
diff --git a/WebApplication1/WebApplication1.csproj b/WebApplication1/WebApplication1.csproj
index 8f3fd5f..10d40e9 100644
--- a/WebApplication1/WebApplication1.csproj
+++ b/WebApplication1/WebApplication1.csproj
@@ -1,14 +1,21 @@
- netcoreapp2.1
+ netcoreapp3.0
aspnet-WebApplication1-5806ED25-D9C9-4417-B0E6-98D2AF1BB81F
-
-
+
+
+
+
+
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+ all
+
+