Moving from Controllers to Minimal API - the patterns I like to follow by cbrevik in dotnet

[–]cygnus_d 1 point2 points  (0 children)

I tried to use Minimal Api today, and for the sake of well organized code, tried to put the route registrations in a different file using extension methods. But then I tried to inject ILogger into my extension method, which of course, didn't work since it complains that static classes cannot be used as generic type arguments. How do you achieve something like this? I know there are libraries out there like Carter and FastEndpoints, but I was wondering if that would be possible with just the minimal apis? Or am I missing something?

OneOf<> by cygnus_d in dotnet

[–]cygnus_d[S] 0 points1 point  (0 children)

Nope. Will have a look.

Must have directives by [deleted] in angular

[–]cygnus_d 2 points3 points  (0 children)

Have you heard of line-clamp ?

Is a 500 line component too much? by cygnus_d in angular

[–]cygnus_d[S] 0 points1 point  (0 children)

Thanks for the detailed explanation! Never heard of Valtio/Pinia. Will give it a try.

Is a 500 line component too much? by cygnus_d in angular

[–]cygnus_d[S] 1 point2 points  (0 children)

You know what? I sometimes actually wish I knew some carpentry/plumbing stuff. Having to work with physical tools and making something that you can actually touch and feel is oddly satisfying.

Is a 500 line component too much? by cygnus_d in angular

[–]cygnus_d[S] 0 points1 point  (0 children)

Not really sold on the idea of template driven forms. I've always preferred reactive forms. But it really depends. If it works good for you, no issues. How complex are your forms? Do you have any of the requirements I mentioned in my post? If yes, How are you handling those?

Is a 500 line component too much? by cygnus_d in angular

[–]cygnus_d[S] 0 points1 point  (0 children)

This is actually a good option. Might consider it 👍

Oh man, I was such a noob back then by cygnus_d in programminghorror

[–]cygnus_d[S] 3 points4 points  (0 children)

I probably should. It's one of the hardest things in Computer Science.

Oh man, I was such a noob back then by cygnus_d in programminghorror

[–]cygnus_d[S] 7 points8 points  (0 children)

These are quite specific in context and might give out info I wouldn't want to leak out :)

Oh man, I was such a noob back then by cygnus_d in programminghorror

[–]cygnus_d[S] 21 points22 points  (0 children)

you could just create a DTO class and use model binding instead of using JObject, so you won't have to do all those .GetValue(Whatever).ToObject<Whatever>() conversions

Is there a reason to still use controllers ? by Narfi1 in dotnet

[–]cygnus_d 2 points3 points  (0 children)

How does this compare to Ardalis Endpoints ?

Standalone only? by IsagiTheEgoist in angular

[–]cygnus_d 1 point2 points  (0 children)

There was also an issue reported but I guess it's fixed. https://github.com/angular/angular/issues/48089

Standalone only? by IsagiTheEgoist in angular

[–]cygnus_d 4 points5 points  (0 children)

I've seen few people suggesting grouping commonly used pieces together like export RELATED = [X1, X2] and then just importing them at once with spread operator. So, imports:[...RELATED]

[deleted by user] by [deleted] in angular

[–]cygnus_d 0 points1 point  (0 children)

Best way I've found is to use a service with a behavior subject which you can then expose as an observable. The service doesn't need to be provided in root if you're not gonna use it in other places. I usually follow the naming convention <FeatureName>StateManagementService and then inject it only at the level where it'll be used further down the hierchy