-
Notifications
You must be signed in to change notification settings - Fork 10k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
324a329
commit 96803ee
Showing
5 changed files
with
172 additions
and
260 deletions.
There are no files selected for viewing
104 changes: 85 additions & 19 deletions
104
src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/Program.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,92 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Threading.Tasks; | ||
#if (IndividualLocalAuth) | ||
using Microsoft.AspNetCore.Authentication; | ||
#endif | ||
using Microsoft.AspNetCore.Builder; | ||
using Microsoft.AspNetCore.Hosting; | ||
#if (IndividualLocalAuth) | ||
using Microsoft.AspNetCore.Identity; | ||
using Microsoft.AspNetCore.Identity.UI; | ||
#endif | ||
#if (IndividualLocalAuth) | ||
using Microsoft.EntityFrameworkCore; | ||
#endif | ||
using Microsoft.Extensions.Configuration; | ||
using Microsoft.Extensions.DependencyInjection; | ||
using Microsoft.Extensions.Hosting; | ||
using Microsoft.Extensions.Logging; | ||
#if (IndividualLocalAuth) | ||
using Company.WebApplication1.Data; | ||
using Company.WebApplication1.Models; | ||
#endif | ||
|
||
namespace Company.WebApplication1 | ||
var builder = WebApplication.CreateBuilder(args); | ||
|
||
// Add services to the container. | ||
#if (IndividualLocalAuth) | ||
var connectionString = Configuration.GetConnectionString("DefaultConnection"); | ||
builder.Services.AddDbContext<ApplicationDbContext>(options => | ||
#if (UseLocalDB) | ||
options.UseSqlServer(connectionString)); | ||
#else | ||
options.UseSqlite(connectionString)); | ||
#endif | ||
builder.Services.AddDatabaseDeveloperPageExceptionFilter(); | ||
|
||
builder.Services.AddDefaultIdentity<ApplicationUser>(options => options.SignIn.RequireConfirmedAccount = true) | ||
.AddEntityFrameworkStores<ApplicationDbContext>(); | ||
|
||
builder.Services.AddIdentityServer() | ||
.AddApiAuthorization<ApplicationUser, ApplicationDbContext>(); | ||
|
||
builder.Services.AddAuthentication() | ||
.AddIdentityServerJwt(); | ||
#endif | ||
|
||
builder.Services.AddControllersWithViews(); | ||
#if (IndividualLocalAuth) | ||
builder.Services.AddRazorPages(); | ||
#endif | ||
|
||
var app = builder.Build(); | ||
|
||
// Configure the HTTP request pipeline. | ||
if (app.Environment.IsDevelopment()) | ||
{ | ||
app.UseDeveloperExceptionPage(); | ||
#if (IndividualLocalAuth) | ||
app.UseMigrationsEndPoint(); | ||
#endif | ||
} | ||
else | ||
{ | ||
public class Program | ||
{ | ||
public static void Main(string[] args) | ||
{ | ||
CreateHostBuilder(args).Build().Run(); | ||
} | ||
|
||
public static IHostBuilder CreateHostBuilder(string[] args) => | ||
Host.CreateDefaultBuilder(args) | ||
.ConfigureWebHostDefaults(webBuilder => | ||
{ | ||
webBuilder.UseStartup<Startup>(); | ||
}); | ||
} | ||
#if (RequiresHttps) | ||
// 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(); | ||
#else | ||
} | ||
|
||
#endif | ||
app.UseStaticFiles(); | ||
app.UseRouting(); | ||
|
||
#if (IndividualLocalAuth) | ||
app.UseAuthentication(); | ||
app.UseIdentityServer(); | ||
#endif | ||
#if (!NoAuth) | ||
app.UseAuthorization(); | ||
#endif | ||
|
||
app.MapControllerRoute( | ||
name: "default", | ||
pattern: "{controller}/{action=Index}/{id?}"); | ||
#if (IndividualLocalAuth) | ||
app.MapRazorPages(); | ||
#endif | ||
|
||
app.MapFallbackToFile("index.html");; | ||
|
||
app.Run(); |
109 changes: 0 additions & 109 deletions
109
src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/Startup.cs
This file was deleted.
Oops, something went wrong.
104 changes: 85 additions & 19 deletions
104
src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/Program.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,92 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Threading.Tasks; | ||
#if (IndividualLocalAuth) | ||
using Microsoft.AspNetCore.Authentication; | ||
#endif | ||
using Microsoft.AspNetCore.Builder; | ||
using Microsoft.AspNetCore.Hosting; | ||
#if (IndividualLocalAuth) | ||
using Microsoft.AspNetCore.Identity; | ||
using Microsoft.AspNetCore.Identity.UI; | ||
#endif | ||
#if (IndividualLocalAuth) | ||
using Microsoft.EntityFrameworkCore; | ||
#endif | ||
using Microsoft.Extensions.Configuration; | ||
using Microsoft.Extensions.DependencyInjection; | ||
using Microsoft.Extensions.Hosting; | ||
using Microsoft.Extensions.Logging; | ||
#if (IndividualLocalAuth) | ||
using Company.WebApplication1.Data; | ||
using Company.WebApplication1.Models; | ||
#endif | ||
|
||
namespace Company.WebApplication1 | ||
var builder = WebApplication.CreateBuilder(args); | ||
|
||
// Add services to the container. | ||
#if (IndividualLocalAuth) | ||
var connectionString = Configuration.GetConnectionString("DefaultConnection"); | ||
builder.Services.AddDbContext<ApplicationDbContext>(options => | ||
#if (UseLocalDB) | ||
options.UseSqlServer(connectionString)); | ||
#else | ||
options.UseSqlite(connectionString)); | ||
#endif | ||
builder.Services.AddDatabaseDeveloperPageExceptionFilter(); | ||
|
||
builder.Services.AddDefaultIdentity<ApplicationUser>(options => options.SignIn.RequireConfirmedAccount = true) | ||
.AddEntityFrameworkStores<ApplicationDbContext>(); | ||
|
||
builder.Services.AddIdentityServer() | ||
.AddApiAuthorization<ApplicationUser, ApplicationDbContext>(); | ||
|
||
builder.Services.AddAuthentication() | ||
.AddIdentityServerJwt(); | ||
#endif | ||
|
||
builder.Services.AddControllersWithViews(); | ||
#if (IndividualLocalAuth) | ||
builder.Services.AddRazorPages(); | ||
#endif | ||
|
||
var app = builder.Build(); | ||
|
||
// Configure the HTTP request pipeline. | ||
if (app.Environment.IsDevelopment()) | ||
{ | ||
app.UseDeveloperExceptionPage(); | ||
#if (IndividualLocalAuth) | ||
app.UseMigrationsEndPoint(); | ||
#endif | ||
} | ||
else | ||
{ | ||
public class Program | ||
{ | ||
public static void Main(string[] args) | ||
{ | ||
CreateHostBuilder(args).Build().Run(); | ||
} | ||
|
||
public static IHostBuilder CreateHostBuilder(string[] args) => | ||
Host.CreateDefaultBuilder(args) | ||
.ConfigureWebHostDefaults(webBuilder => | ||
{ | ||
webBuilder.UseStartup<Startup>(); | ||
}); | ||
} | ||
#if (RequiresHttps) | ||
// 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(); | ||
#else | ||
} | ||
|
||
#endif | ||
app.UseStaticFiles(); | ||
app.UseRouting(); | ||
|
||
#if (IndividualLocalAuth) | ||
app.UseAuthentication(); | ||
app.UseIdentityServer(); | ||
#endif | ||
#if (!NoAuth) | ||
app.UseAuthorization(); | ||
#endif | ||
|
||
app.MapControllerRoute( | ||
name: "default", | ||
pattern: "{controller}/{action=Index}/{id?}"); | ||
#if (IndividualLocalAuth) | ||
app.MapRazorPages(); | ||
#endif | ||
|
||
app.MapFallbackToFile("index.html");; | ||
|
||
app.Run(); |
Oops, something went wrong.