cumslvt13
Dealing with sub-models in request endpoint response pattern
I'm using RERP (request endpoint response) pattern to structure my api endpoints. Recently I've noticed that some requests have lots of fields that could be combined into a separate sub-model as example:
It seems obvious that those fields could be mapped to separate model, but question is: where should I put it? Currently my folder structure is following:
I don't really like idea of creating a single folder named
Common
or Shared
and dumping all of the similar models there nor I like the idea of keeping that model with requests, because name would be too generic like CompanyInfoModel
which doesn't actually say anything about relation to the CreateCustomerRequest
when viewed in swagger.
What are your approaches/advises in such situations. How you deal with that kind of stuff?1 replies
Background upload of an IFormFile to Azure blob storage
I have a few endpoints that are dealing with files in my app. Some of them may accept
IFormFileCollection
or regular IFormFile
. During the request hanlding content of those files is being uploaded to azure blob storage. The problem I encountered is that process of uploading to the blob storage can take 3-5 seconds. Are there any options to upload files in the background and return after persisting data to the db? As far as I understand it would be a bad practice to reference/use IFormFile
after returning response the the client, so just creating a background job and passing it as a reference would not be an option18 replies
✅ What's the point of ModelSnapshot in ef core migrations
I'm trying to move my migrations to a separate projects in case I want to change a db provider. I've moved my existing migrations to the separate project and that's what I've got now:
In my
Application.Core
project I've added the following config for DI:
I didn't add x => x.MigrationsAssembly("WebApplication1.Migrations")
call as it shown in the docs (https://learn.microsoft.com/en-us/ef/core/managing-schemas/migrations/projects)
My questions is: how come EF still works even though it doesn't reference Migrations project where AppContextModelSnapshot
is stored? And what are potential issues with my approach?37 replies
❔ Loading/Using blazor in a webworker
We're using blazor wasm in a web project with a SPA combination. Blazor is used purely for business and computation logic (no components at all), while Angular is used to render UI and for user interactions. Since blazor is kind of slow and clumsy, I'd like to try to improve its performance. Questions are following:
1) Is there a ready solution/example on how to load blazor files in the webworker to offload the work from the main UI thread?
2) Is it possible to keep blazor running in a webworker and call dotnet methods from main UI?
3 replies
✅ Binding array with default value doesn't work
I've got the following model and controller
The
https://localhost:5001/test?Test=3&Sections=USER
resolves to {"test":3,"sections":[]}
, but if I remove default value for a Sections
property it resolves to {"test":3,"sections":["USER"]}
. Why behavior is different from int default value?52 replies
❔ Decent reference ASP.NET project
I am looking for a reference project for investigation purposes. Appreciate if anyone can share repo link of a somewhat complex ASP.NET project. I've seen some repos with example of Clean Architecture on github, but they seem to be a bit poor without any business logic. Something like
dotnet-podcasts
or eShopOnContainers
would do great.2 replies
dotnet publish solution excluding projects with tests
Is it possible to publish solution and exclude projects with tests?
I have the following project structure and docker image doesn't actually need those
*.Tests
projects to be published:
Also, is it a good idea to build single docker image instead of two separate ones? DemoApp.Publisher
and DemoApp.Worker
are meant to be standalone apps.3 replies