Core
Explore posts from servers✅ .NET 8 enum to string serialization throws an exception
Hello,
Following the docs, a custom
JsonSerializerContext
is applied on the controllers, yet an exception is thrown.
The exception:
I have followed the docs:
https://learn.microsoft.com/en-us/dotnet/standard/serialization/system-text-json/source-generation#combine-source-generators
https://learn.microsoft.com/en-us/dotnet/standard/serialization/system-text-json/source-generation#blanket-policy21 replies
✅ Storing user related data when using an auth provider
Hello,
When using an auth provider, all the user data, like ID, email, etc. is stored and managed by the provider. Regarding that, do I need to store the user data in my SQL database and make relation based on that?
Or would it be better to simply add an extra userId column to tables where needed and leave it be? (without any relationship)
13 replies
✅ NodaTime JSON Serialization
Hello,
.NET will parse any date format to
DateTime
or DateTimeOffset
, but what happens if I give NodaTime control over the serialization?
Assuming I accept an Instant
in the DTO and a request comes in, but the format is not ISO-8601
, will it be able to convert any type of date like .NET does, or will it only work with strict types?
From the docs:
21 replies
✅ Background jobs, choosing the right library
Hello,
I need to implement a scheduled job that will be periodically executed.
Why are there so many libraries: Hangfire, Quartz, Coravel? Even .NET offeres the
BackgroundService
out of the box.
How do I choose the right library? Literally every one of them gets the job done...16 replies
Is there a method that throws an exception if a config value is not present in appsettings?
Hello,
Getting configuration values from
appsettings.json
is done via calling builder.Configuration["name"]
. This way few of my services might get a null property, without throwing error before build.
Is there an existing method that will throw an exception if the config value is null
?12 replies
✅ Azure key vault with microservices
Hello,
Right now I have 2 microservice, they communicate with RabbitMq, so the credentials are the same.
Would it be more reasonable to have 2 key vaults storing the same secrets, one vault per each microservice, or create an extra vault for shared secrets?
2 vault, 1 per each microservice
or
3 vault, 1 per each microservice + a shared one?19 replies
✅ EF: how to structure same EF select query with no tracking?
Hello,
I need the exact same select query with and without tracking. Should I implement it in 2 separate methods or a single method with a
bool
parameter that would determine if the query will use tracking or not (e.g. SelectSomething(enableTracking = true)
)?12 replies
✅ EF Best way to do UPDATE on entity
Hello,
EF by default tracks entities. That means, if a property of an entity is modified,
SaveChanges()
will do the update.
Now, I set new values for the properties in the business logic layer, and the repository layer is responsible for any DB operation.
My current method looks like this.... Is there a clearer approach or leave this as it is?
24 replies
✅ Should NuGet package be installed both in the main project and class library?
Hello,
A NuGet package exposes some interfaces which I would like to implement, but the library also needs configuration, which must happen in
Program.cs
.
Should I only install the NuGet package in the class library and reference it in the main project, or install it in each project?14 replies
Expose localhost to the internet without a tunnel
Hello,
I am looking for resources/possible solution for my use case.
I am developing a feature which is not testable with any of the tunnel providers that expose my
localhost
to the internet, (I have already tried ngrok, pinggy and cloudflare tunnels).
I have no home server, just my router, laptop and domain. Is there a way to still expose my .NET app trough an IP and point the domain to that IP address?
If yes, then what is the right term which I need to search for in the browser? People usually have a dedicated home server for this purpose...9 replies
✅ Can .NET handle SSL certificates at runtime?
Hello,
I need to issue/handle SSL certificates for every domain that points to my own domain (users can add their domains to trough a Web API at runtime).
Is it possible to provide certificates when requests come in from different domains?
41 replies
How to block the execution of a method when running EF migration
Hello,
I have a background service registered in Program.cs. It does an HTTP call to an external service that is essential for getting some configuration settings.
This HTTP call should not happen when
ef
commands are executed, so I was wondering what solutions might be there.24 replies