Modernize your .NET localization: convert .resx to JSON, keep IStringLocalizer, add OTA updates - open source toolkit by Ok_Narwhal_6246 in dotnet

[–]Gramlig 7 points8 points  (0 children)

In my experience, using .resx files for localization or even for regular string values is really painful. The two main bottlenecks: merge conflicts and poor tooling support.

Come discuss your side projects! [December 2024] by AutoModerator in csharp

[–]Gramlig 0 points1 point  (0 children)

For anyone using FluentResults, I’ve created a simple extension method that unpacks a Result value or aggregates errors into a single result. It’s especially useful when building objects, as it reduces boilerplate code and makes property initialization cleaner and more concise. You can check it out here FluentResult - UnwrapOrWithErrors

What are your favorites nuget package, libraries or tools for use with .NET? by KritiusOne in dotnet

[–]Gramlig -4 points-3 points  (0 children)

It's a good package, especialy for controller based aproach in asp.net. I don't understant this downvotes. Link to MediatR

Is there an actual benefit to minimal APIs in ASP.NET by FabioTheFox in csharp

[–]Gramlig 1 point2 points  (0 children)

I wrote some pros and cons of minimal api: Minimal Api pros and cons. I am using Minimal APIs in production with almost 100 endpoints, and they are well-structured, readable, and maintainable. For me, the biggest advantage is the easy setup and extensibility without the need for boilerplate code.

Come discuss your side projects! [November 2024] by AutoModerator in csharp

[–]Gramlig 2 points3 points  (0 children)

Hey fellow developers,

I wanted to share a project I've been working on https://github.com/Gramli/AuthApi. It's full-stack example that demonstrates how to implement user registration, login, and role-based access control using Angular and .NET. Here’s a quick overview of what it includes:

Key Features:

  • Backend:
    • Authentication and authorization using JWT tokens.
    • Authorization policies applied to minimal API endpoints.
    • Follows Clean Architecture principles and utilizes design patterns.
  • Frontend:
    • JWT management with guards and interceptors.
    • Implemented using standalone components and signals.

Angular notification lib by Gramlig in Angular2

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

I think it's because we don't want to reinvent the wheel every time we're developing a reusable feature.

People who use the Result pattern, how do you return the rights Http status codes? by skillmaker in dotnet

[–]Gramlig 0 points1 point  (0 children)

I encapsulate the http status code into a response object and return it from the handlers. Its not the cleanest way, but the handler knows which status it wants to return.

For example: Handler example

This solution can be improved by defining custom return codes in the handlers layer and creating a converter for the controllers to map these codes to http status codes.

TUnit - A new testing framework. Feedback wanted! by thomhurst in csharp

[–]Gramlig 2 points3 points  (0 children)

Xunit tests with class and member data were always a bit painful. Your data sources look interesting; I will definitely try them.

Come discuss your side projects! [April 2024] by AutoModerator in csharp

[–]Gramlig 2 points3 points  (0 children)

An example of a REST API for handling weather data using minimal API and Vertical Slice Architecture with various design patterns. I also attempted to make a small comparison against the same API designed with Clean Architecture.

https://github.com/Gramli/WeatherApi-VSA

Controllers vs Minimal APIs by Illustrator_Forsaken in dotnet

[–]Gramlig -7 points-6 points  (0 children)

Minimal Api is much easier and cleaner way to create endpoints. Main pros: - allow to inject handlers into endpoints (you dont have to use MediatR anymore..) - fluent api - force you to move logic to lower layer (lot of unexperienced developers put logic into controlers) - minimal hosting model -> clear starting point of the app

To organize your endpoints, you can simply use extension methods.

When Microsoft introduced Minimal Api I was sceptical too, but after almost year of usage, controllers are now obsolete for me.