Populate IConfiguration for unit tests

You can use MemoryConfigurationBuilderExtensions to provide it via a dictionary. using Microsoft.Extensions.Configuration; var myConfiguration = new Dictionary<string, string> { {“Key1”, “Value1”}, {“Nested:Key1”, “NestedValue1”}, {“Nested:Key2”, “NestedValue2”} }; var configuration = new ConfigurationBuilder() .AddInMemoryCollection(myConfiguration) .Build(); The equivalent JSON would be: { “Key1”: “Value1”, “Nested”: { “Key1”: “NestedValue1”, “Key2”: “NestedValue2” } } The equivalent Environment Variables would be … Read more

.NET Core MVC Page Not Refreshing After Changes

In ASP.NET Core 3.0 and higher, RazorViewEngineOptions.AllowRecompilingViewsOnFileChange is not available. Surprised that refreshing a view while the app is running did not work, I discovered the following solution: Add Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation NuGet package to the project Add the following in Startup.cs: services.AddControllersWithViews().AddRazorRuntimeCompilation(); Here’s the full explanation for the curious.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)