Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/dotnet/spa-templates.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJavier Calvarro Nelson <jacalvar@microsoft.com>2021-10-11 17:17:35 +0300
committerGitHub <noreply@github.com>2021-10-11 17:17:35 +0300
commit64a6ddc5019ead9f5140c92c46ec4d8f6303b9fb (patch)
tree92bc6f2647fb9b5b7a6497c02bd040359dc0ddd1
parentb861c47fa9f3856acdc3a462ee7b6307960121ed (diff)
Apply nullabiity fixes (#24)
Throws if the connection string is not present
-rw-r--r--src/content/Angular-CSharp/Program.cs2
-rw-r--r--src/content/React-CSharp/Program.cs2
2 files changed, 2 insertions, 2 deletions
diff --git a/src/content/Angular-CSharp/Program.cs b/src/content/Angular-CSharp/Program.cs
index f215704..696eb55 100644
--- a/src/content/Angular-CSharp/Program.cs
+++ b/src/content/Angular-CSharp/Program.cs
@@ -11,7 +11,7 @@ var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
#if (IndividualLocalAuth)
-var connectionString = builder.Configuration.GetConnectionString("DefaultConnection");
+var connectionString = builder.Configuration.GetConnectionString("DefaultConnection") ?? throw new InvalidOperationException("Connection string 'DefaultConnection' not found.");
builder.Services.AddDbContext<ApplicationDbContext>(options =>
#if (UseLocalDB)
options.UseSqlServer(connectionString));
diff --git a/src/content/React-CSharp/Program.cs b/src/content/React-CSharp/Program.cs
index f215704..696eb55 100644
--- a/src/content/React-CSharp/Program.cs
+++ b/src/content/React-CSharp/Program.cs
@@ -11,7 +11,7 @@ var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
#if (IndividualLocalAuth)
-var connectionString = builder.Configuration.GetConnectionString("DefaultConnection");
+var connectionString = builder.Configuration.GetConnectionString("DefaultConnection") ?? throw new InvalidOperationException("Connection string 'DefaultConnection' not found.");
builder.Services.AddDbContext<ApplicationDbContext>(options =>
#if (UseLocalDB)
options.UseSqlServer(connectionString));