ConfusedPenguin
ConfusedPenguin
CC#
Created by Spaxter on 8/9/2024 in #help
✅ Transient DbContext vs DbContextFactory
AddDbContext creates the specified DbContext type as a scoped service, where-as the Factory, you can yourself manage the life-time (by determining when to create it).
4 replies
CC#
Created by Spaxter on 8/9/2024 in #help
✅ Transient DbContext vs DbContextFactory
There isn't a difference as you point out. There are, however, instances where the Factory can provide a service scope for applications where scopes are not possible (Blazor being an example of this).
4 replies
CC#
Created by kunio_kun on 10/12/2022 in #help
Getting Rid of Nullability Warnings
If you are satisfied with response, close this post and open new one with question.
12 replies
CC#
Created by kunio_kun on 10/12/2022 in #help
Getting Rid of Nullability Warnings
Here are some examples of how to solve different problems, but I urge to handle each case as it should be (there are situations where you can mark code with ! to tell the compiler that you (the developer) ensure that it's not null. https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/compiler-messages/nullable-warnings
12 replies
CC#
Created by İrşat on 10/12/2022 in #help
How to process IActionResult Ok(value) return in back end. [Answered]
No problem.
9 replies
CC#
Created by İrşat on 10/12/2022 in #help
How to process IActionResult Ok(value) return in back end. [Answered]
Use the regular .GetAsync() if you need to get the HttpResponse object instead of the deserialized http response.
9 replies
CC#
Created by İrşat on 10/12/2022 in #help
How to process IActionResult Ok(value) return in back end. [Answered]
However, this is an extension method that deserializes the response into the type you proivide, thus not returning the HttpResponse.
9 replies
CC#
Created by İrşat on 10/12/2022 in #help
How to process IActionResult Ok(value) return in back end. [Answered]
You are correct, the URL is what you need. You can also provide a response type (i.e. the type that will be returned from the method-call).
9 replies
CC#
Created by ConfusedPenguin on 10/7/2022 in #help
Mocking derived class with abstract base class
I would only like to ensure that depending on what the answer is from
await repository.GetAsync(...)
await repository.GetAsync(...)
the correct HTTP response is returned.
5 replies
CC#
Created by ConfusedPenguin on 10/7/2022 in #help
Mocking derived class with abstract base class
I would of course mock away all dependencies.
5 replies