C
C#10mo ago
Davide

❔ IOptions pattern in WebAPI getting null value

I'm trying to use the IOptions pattern with Dep. Injection, however when i debug the code i get null values in the injected object. I've tried to use the .AddOptions() method to the builder ServiceCollection but still i get null values
6 Replies
Davide
Davide10mo ago
phaseshift
phaseshift10mo ago
whats the appsettings config look like?
life grinder
life grinder10mo ago
are members of Bot properties?
phaseshift
phaseshift10mo ago
No theyre fields - that's likely the issue. I don't think config/options binding work with fields?
life grinder
life grinder10mo ago
oops i didn't see the image it doesn't maybe there's a specific setting to enable it, but it's unusual and not recommended
Accord
Accord10mo ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server
More Posts
❔ Button click is advancing control focusI am writing a program which runs a test after the user clicks a button. The test takes a couple sec❔ If you needed to bulk sync data from an API into a DB, what would you use as a PK for child data?For example imagine you get this data back HOURLY from GET /users: ```json { "users": [ ❔ Get website icons from URLHey, so I'm currently learning C# (i have coded in other languages already) and for my first project❔ Serilog Extend LogLevels or Intercept LogsI am using Serilog and I have a specific use case right. I got three sinks (Console, File, SQLServer❔ [Resolved] How to delete the OBJ folder after a buildHello it's been several days that when I try to build it gives me this error: ```csharp Fody: An ❔ Can you create .net core Web API with c# dev kit in vscode that DOESN'T use the minimal syntax?Seems like the option is not there like in VS.❔ AWS ALB with Lambda target group with dotnet 6 not getting multi value querystring parameters?Does anyone know all the places that need to be checked, to ensure multi value querystring parameter❔ Binding a DTO from route and bodyI have been trying to do this for the last 5 years. I want to be able to send something like a put r❔ How can I make a function of a simple condition EF Core translatableHey, so I have this function, but it seems to throw an error by not being translatable by EF Core, e❔ ASP.NET Core ignoring custom DynamicRouteValueTransformerI have created a custom DynamicRouteValueTransformer to help me switch between 2 controllers and act