The DbContext of type cannot be pooled because it does not have a single public constructor accepting a single parameter of type DbContextOptions

When using DbContext Pooling, your own state (e.g. private fields) in your derived DbContext class will be preserved. Which means the lifetime of your services is now singleton. That’s why you shouldn’t have other injected services here. But it’s possible to query the required services this way: First we should use the UseInternalServiceProvider method on … Read more

ASP.Net Core SAML authentication

This is probably basically an updated version of Anders Abel’s answer, but: I used https://github.com/Sustainsys/Saml2. They have a nuget package with 36k downloads called “Sustainsys.Saml2.AspNetCore2”. They have a helpful example .net core app using it that also uses .net core identity here: https://github.com/Sustainsys/Saml2/tree/master/Samples/SampleAspNetCore2ApplicationNETFramework (take a look at their startup.cs and also their external login razor … Read more

Generate .NET Client from Swagger [closed]

You can use the swagger-codegen tool from the swagger project. It produces C# files that use RestClient for the HTTP calls Newtonsoft.Json for json marshalling .NET DataContract for the models. You can either download the cli app or use the online editor. The petstore example models look like this: using System; using System.Text; using System.Collections; … Read more

Cannot add duplicate collection entry of type ‘add’ with unique key attribute ‘name’ set to ‘aspNetCore

The answer above didn’t work for me, however DavidG’s comment did solve my problem, so going to post as an answer in case it helps someone else. For me, I was not running it as a sub-application, and a project that had been working for me no issue for over a year suddenly stopped working … Read more

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