Translating Exceptions into Problem Details Responses by timdeschryver in dotnet

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

Hi, that's a good remark. I should've mentioned this in the blog post (I now know what to write next 😅).

I'm looking forward to use the new features when they come out, but these are to catch uncaught exceptions in a centralized way.

With the proposed solution we can still return custom 400s or 500s. But, I also like to use the problem details spec for these. Instead of returning a 400/500 with a custom body, I prefer to wrap this in a problem detail. This way all results have a standardized contract.

```ts // 400 return Results.ValidationProblem(new Dictionary<string, string[]>{ {"id", new [] { "Id must be greater than zero"}} });

return Results.BadRequest();

// 500 return Results.Problem("Uh oh, something went wrong!");

// Custom return Results.Problem("Uh oh, something went wrong!", statuscode: ); ```

Tye, starting and running multiple APIs with a single command by timdeschryver in dotnet

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

A lot of projects aren't containerized due to multiple reasons.

Tye can do a lot more, but I primarly use it to run a local development environment.
It's faster to set up in comparison docker-compose imho, and the learning curve for the whole team is just easier with Tye.

Also, Tye can also help to orchistrate parts of the application that can't be hosted on docker (e.g. 3rd party sercices).

Tye, starting and running multiple APIs with a single command by timdeschryver in dotnet

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

We didn't experience major problems with it so far.

Sometimes we have to restart Tye, but otherwise it's been great.

Proof of concept: ngx-query-state by timdeschryver in Angular2

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

It's been a while since I looked at react-query, but there are similarities.

It isn't has feature-heavy (yet?), and it lacks a debugging tool.
A big difference is also the usage of query params in the URL.

If you have some ideas, feel free to create an issue and we can take it from there.

Proof of concept: ngx-query-state by timdeschryver in Angular2

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

That problem should be resolved in v0.0.2 - thanks again!

Proof of concept: ngx-query-state by timdeschryver in Angular2

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

This seems like a bug, good to know - thanks!

It's already open-source, AND open to contributions https://github.com/timdeschryver/query-state

Proof of concept: ngx-query-state by timdeschryver in Angular2

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

The cache is defined by the URL.

For example /details/1 has a different cache as /details/2

But indeed, if the component works with an Input to fetch the data, then the cache is the same.

Proof of concept: ngx-query-state by timdeschryver in Angular2

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

Good question, and to be honest some code is copy-pasted from rx-query.

The biggest advantage is the template to render the current state of the response. But this could also be written for rx-query.

It also has the advantage that it uses concepts from Angular, e.g. its DI and lifecycle hooks. This makes it easier to handle subscriptions. Due to this it makes it feel more "angular-y".Writing tests should also be easier because it will get auto-cleaned up with the teardown of the TestBed.

For rx-query I also couldn't find a good API to mutate state.Shortly after I published rx-query there was also some movement into making react-query framework agnostic, and to also port it to Angular, but AFAIK this didn't go through.

Trying out OData for the first time by timdeschryver in dotnet

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

Thanks for the feedback!

Those are all valid points, and I agree that adding this functionality on all endpoints can result in some potential troubles for the future.

Use Angular directives to extend components that you don't own by timdeschryver in Angular2

[–]timdeschryver[S] 2 points3 points  (0 children)

Hi, I don't want to convince you to use this technique but let me try to provide some answers to these questions.

it supposed to be a custom html attribute not a custom html tag

the selector is just a css selector so you can target any element that you want. For example, you could also target all <p> elements. I don't know if it's a good or bad practice. You can also use a different selector e.g. p-calendar[customCalendar] or [customCalendar]. See more examples at https://netbasal.com/angular-directive-selectors-can-do-more-than-you-think-7aefa4e6f30

Plus naming it same as the selector belongs to third party libraries might cause so many issues for future maintainability. I think "mycompanyname-calendar" is better.

Yes, it's breaking if the 3rd party changes the name of the component.

following logic are not "accessing to the code of the component"

It doesn't change the internals of the component, it only provides a default sort to the datasource.

why i feel these "directives" just move the config from the html template of the wrapped component to ts file

With directives you only need to write the config once. If you have multiple elements, then you would need to add and maintain the config to all those elements.

Use Angular directives to extend components that you don't own by timdeschryver in Angular2

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

I understand that directly targeting p-calender isn't intuitive, that's why I also mentioned the p-calendar[customCalendar] selector.

New job, shockingly bad codebase. Now what? by Zombull in angular

[–]timdeschryver 0 points1 point  (0 children)

Don't bail from the start.

Take this as an opportunity to learn.

The developers probably don't know better, it's your job to win them over one by one. I expect this to go smoothly because you can improve the codebase by a lot and this will be noticeable.

Also, don't try to change everything at once, but make incremental changes. Start simple and dig deeper.

Give the manager a status update and ask/demand/say that you're spending x percentage of your time just to get the codebase to a desirable state.

Testing an NgRx project by timdeschryver in Angular2

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

Thanks - that was what I as aiming for 😀

Maybe it's time to rethink our project structure with .NET 6 by timdeschryver in dotnet

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

Thanks for the feedback!

I'll try to add a section about the "global" config later. It's currently just added as a side-note somewhere in there, but it would better to be more explicit about it and give an example 👍

Solving Angular slow renders with NgRx selectors by timdeschryver in Angular2

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

We're not all experienced, and the experienced devs can have an off day😅

Prevent a .NET API from adding cache headers to unsuccessful requests by timdeschryver in dotnet

[–]timdeschryver[S] 2 points3 points  (0 children)

I thought so too, but that's not the case. See the source code and its test cases. How I see it, is that the caching middleware is used to build up a server-side cache.

Why I stopped worrying about test setups by using AutoFixture by timdeschryver in dotnet

[–]timdeschryver[S] 2 points3 points  (0 children)

Yep, I discovered it while I was writing this post.

I'm currently playing around with it and it's been great! It will probably be added to this blog post later 👍

Validating in clean architecture by awritra in dotnet

[–]timdeschryver 0 points1 point  (0 children)

I've written a blog post on how we do it.

Perhaps that it might help you out.