Issue with the connectionstring when executing with VSCode
I tried the below using VSCode and got the error related to connectionstring.
I have updated the connectionstring to "NHLStatsDb": "Data Source=.;Initial Catalog=NHLStats;Trusted_Connection=True;MultipleActiveResultSets=true" On running the command by navigating to the dotnet run command from the root of the \NHLStats.Api folder
I am getting the following error: Application startup exception: System.ArgumentNullException: Value cannot be null. Parameter name: connectionString at Microsoft.EntityFrameworkCore.Utilities.Check.NotEmpty(String value, String parameterName) at Microsoft.EntityFrameworkCore.SqlServerDbContextOptionsExtensions.UseSqlServer(DbContextOptionsBuilder optionsBuilder, String connectionString, Action`1 sqlServerOptionsAction)
I opened the project using VS2017 and found all this works fine.
Any help on this is much appreciated
In order to run this anywhere other than Visual Studio, you will need to set an Environmental variable to trigger Developer appsettings.
If you are using Powershell and starting from the command line you can use:
$env:ASPNETCORE_ENVIRONMENT="Development"; dotnet run
For other shells, see the docs here: https://docs.microsoft.com/en-us/aspnet/core/fundamentals/environments?view=aspnetcore-2.2#windows
Also for anyone running, the URL for GraphiQL Explorer is http://localhost:5000/graphql/ after startup.
Good Luck!