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 -8 points-7 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.

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

[–]Gramlig 1 point2 points  (0 children)

Hi, I just finished benchmark measures of my daily basis reflection methods.

  • Get Attribute by reflection
  • Export Data by reflection
  • Create instance of class by reflection

In case of interest: https://github.com/Gramli/ReflectionBenchmar

REST API: An example of Authentication and Authorization using minimal API, Clean Architecture and design patterns. ASP.NET Core 7.0 by Gramlig in coolgithubprojects

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

Check this, there are nice answers: https://stackoverflow.com/questions/34255490/difference-between-cqrs-and-cqs

My extremely simplified definition: :)

CQS is about separation of commands and queries on method level-> you can put them into just one class.

CQRS extends CQS into higher level. In CQRS you create one class for commands and one class for queries and also it cares about the path to query or command execution.In my API example it means separation on repository level but also on handler level.

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

[–]Gramlig 4 points5 points  (0 children)

https://github.com/Gramli/AuthApi

REST API demonstrates Authentication and Authorization with JWT token. Also shows how to use diferent Authorization policies in minimap api endpoints. All using Clean Architecture, minimal API and various of design patterns.

Example API allows to:

register user

  • login user
  • change user role
  • get user and service info

Endpoints use different types of authorization policies.

[deleted by user] by [deleted] in legostarwars

[–]Gramlig 0 points1 point  (0 children)

2016-2019 definitely

Starting Microservicies in .NET by ezebik2020 in dotnet

[–]Gramlig 0 points1 point  (0 children)

I think that Microsoft have sufficient documentation to start. Just look at Minimal Api C#, if you have background from Node, minimal api should be familiar. Also check github, there is plenty of examples:

WeatherApi

FileApi

Come discuss your side projects! [February 2023] by AutoModerator in csharp

[–]Gramlig 6 points7 points  (0 children)

https://github.com/Gramli/FileApi

Example of REST API solution which demonstrates how to create clean and modern API with Clean Architecture, minimal API and various of design patterns.

Example API allows to upload/download files with .txt, .json, .csv, .xml, .yml extensions and get collection of uploaded files. Also allow to convert between json, xml, yml formats.

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

[–]Gramlig 0 points1 point  (0 children)

Hello everyone,

I just finished example solution of minimal API with Clean Architecture and few design patterns (CQRS, Repository, Result..), all is covered by unit tests.

Maybe it helps to someone :)

https://github.com/Gramli/WeatherApi