### Setup .NET 9.0 Environment with Bash Source: https://github.com/eduardopires/equinoxproject/blob/master/AGENTS.md This script installs .NET 9.0 SDK and its dependencies on a Debian-based Linux system. It updates package lists, installs necessary tools, configures the Microsoft package repository, installs the SDK, and verifies the installation. It's designed to be run in environments with limited internet access after the initial setup phase. ```Bash apt-get update && apt-get upgrade -y ``` ```Bash apt-get install -y wget apt-transport-https ca-certificates ``` ```Bash wget https://packages.microsoft.com/config/ubuntu/$(lsb_release -rs)/packages-microsoft-prod.deb -O packages-microsoft-prod.deb dpkg -i packages-microsoft-prod.deb rm packages-microsoft-prod.deb apt-get update ``` ```Bash apt-get install -y dotnet-sdk-9.0 ``` ```Bash dotnet --version ``` ```Bash apt-get autoremove -y ``` -------------------------------- ### Dependency Injection and AutoMapper Setup Source: https://github.com/eduardopires/equinoxproject/blob/master/docs/index.md The project leverages .NET Core Native DI for dependency injection and AutoMapper for object-to-object mapping. These components streamline development and improve code maintainability. ```C# .NET Core Native DI AutoMapper Improvements in Automapper Setup ``` -------------------------------- ### ASP.NET Core WebAPI with JWT Authentication Source: https://github.com/eduardopires/equinoxproject/blob/master/docs/index.md This snippet demonstrates the implementation of ASP.NET Core WebAPI with JWT Bearer Authentication. It includes setup for JWT support in Swagger UI, enabling secure API access. ```C# Added JWT (Bearer) authentication for WebAPI Added JWT support in Swagger ``` -------------------------------- ### Entity Framework Core 9.0 Implementation Source: https://github.com/eduardopires/equinoxproject/blob/master/README.md Utilizes Entity Framework Core 9.0 for data access, including custom automatic mapping and built-in SQLite support with automatic migrations. This simplifies database interactions and setup. ```C# // Example of configuring Entity Framework Core with SQLite and migrations // In Startup.cs (ConfigureServices): // services.AddDbContext(options => // options.UseSqlite(Configuration.GetConnectionString("DefaultConnection"), // b => b.MigrationsAssembly("EquinoxProject.Data.Migrations"))); // Specify migration assembly // Example DbContext: // public class MyDbContext : DbContext // { // public MyDbContext(DbContextOptions options) : base(options) {} // // public DbSet MyEntities { get; set; } // // protected override void OnModelCreating(ModelBuilder modelBuilder) // { // // Apply entity configurations and relationships here // base.OnModelCreating(modelBuilder); // } // } ``` -------------------------------- ### Swagger UI for API Documentation Source: https://github.com/eduardopires/equinoxproject/blob/master/docs/index.md Swagger UI is integrated to provide interactive API documentation, allowing for easy viewing and testing of the application's endpoints. ```C# Adding Swagger UI for better viewing and testing ``` -------------------------------- ### ASP.NET MVC Core and WebAPI Core Source: https://github.com/eduardopires/equinoxproject/blob/master/docs/index.md The project features ASP.NET MVC Core for building the user interface and ASP.NET WebAPI Core for exposing application features as services. This provides a robust foundation for web application development. ```C# ASP.NET MVC Core ASP.NET WebApi Core with JWT Bearer Authentication ``` -------------------------------- ### NetDevPack.SimpleMediator for CQRS Source: https://github.com/eduardopires/equinoxproject/blob/master/README.md Integrates NetDevPack.SimpleMediator to handle CQRS patterns, replacing MediatR for a lighter, native solution. This facilitates command and query handling within the application. ```C# // Example of registering and using NetDevPack.SimpleMediator // In Startup.cs (ConfigureServices): // services.AddSimpleMediator(options => { // options.AddHandlers("EquinoxProject.Application"); // Scan assembly for handlers // }); // Example of sending a command: // public class CreateUserCommandHandler : IRequestHandler // { // public async Task Handle(CreateUserCommand request, CancellationToken cancellationToken) // { // // Handle command logic // return Result.Ok(); // } // } // In a service or controller: // private readonly IMediator _mediator; // // public MyService(IMediator mediator) // { // _mediator = mediator; // } // // public async Task CreateUser(CreateUserCommand command) // { // var result = await _mediator.Send(command); // // Handle result // return Ok(); // } ``` -------------------------------- ### Swagger UI with JWT Support Source: https://github.com/eduardopires/equinoxproject/blob/master/README.md Configures Swagger UI to include JWT support, allowing for easy testing of secured API endpoints directly from the UI. This enhances API discoverability and developer experience. ```C# // Example of Swagger configuration with JWT // In Startup.cs (ConfigureServices): // services.AddSwaggerGen(c => // { // c.SwaggerDoc("v1", new OpenApiInfo { Title = "Equinox Project API", Version = "v1" }); // c.AddSecurityDefinition("Bearer", new OpenApiSecurityScheme // { // Description = "JWT Authorization header using the Bearer scheme.", // Name = "Authorization", // In = ParameterLocation.Header, // Type = SecuritySchemeType.ApiKey, // Scheme = "Bearer" // }); // c.AddSecurityRequirement(new OpenApiRequirement // { // { // new OpenApiSecurityScheme // { // Reference = new OpenApiReference // { // Type = ReferenceType.SecurityScheme, // Id = "Bearer" // } // }, // new string[] {} // } // }); // }); // In Startup.cs (Configure): // app.UseSwagger(); // app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "Equinox Project API V1")); ``` -------------------------------- ### Entity Framework Core Implementation Source: https://github.com/eduardopires/equinoxproject/blob/master/docs/index.md The project utilizes Entity Framework Core 3.1 for data access, integrating with the .NET Core ecosystem. This facilitates database interactions within the application. ```C# Entity Framework Core 3.1 ``` -------------------------------- ### FluentValidator for Domain Validations Source: https://github.com/eduardopires/equinoxproject/blob/master/README.md Integrates FluentValidator for robust domain validation. This ensures data integrity and enforces business rules at the domain level. ```C# // Example of a FluentValidator validator // public class UserValidator : AbstractValidator // { // public UserValidator() // { // RuleFor(user => user.Email) // .NotEmpty() // .EmailAddress(); // // RuleFor(user => user.Password) // .NotEmpty() // .MinimumLength(8); // } // } ``` -------------------------------- ### Custom Automatic Mapping Source: https://github.com/eduardopires/equinoxproject/blob/master/README.md Implements custom automatic mapping solutions, avoiding the need for libraries like AutoMapper. This provides a lightweight approach to object-to-object mapping. ```C# // Example of a custom mapping extension method // public static class MappingExtensions // { // public static TargetType MapTo(this SourceType source) // where TargetType : new() // { // var target = new TargetType(); // // Manual mapping logic here // // Example: target.PropertyName = source.PropertyName; // return target; // } // } ``` -------------------------------- ### ASP.NET Core WebAPI with JWT Bearer Authentication Source: https://github.com/eduardopires/equinoxproject/blob/master/README.md Implements a WebAPI using ASP.NET Core with JWT Bearer Authentication for secure access. It's designed to expose application features and integrate with Swagger UI for testing. ```C# // Example of JWT Bearer Authentication setup in ASP.NET Core // This typically involves configuring services in Startup.cs and applying attributes to controllers. // In Startup.cs (ConfigureServices): // services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme) // .AddJwtBearer(options => // { // options.TokenValidationParameters = new TokenValidationParameters // { // ValidateIssuer = true, // ValidateAudience = true, // ValidateLifetime = true, // ValidateIssuerSigningKey = true, // ValidIssuer = Configuration["Jwt:Issuer"], // ValidAudience = Configuration["Jwt:Audience"], // IssuerSigningKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(Configuration["Jwt:Key"])) // }; // }); // In a Controller: // [Authorize] // public class MyApiController : ControllerBase // { // // ... controller actions ... // } ``` -------------------------------- ### MediatR for Messaging Source: https://github.com/eduardopires/equinoxproject/blob/master/docs/index.md MediatR is integrated for in-memory bus messaging, supporting notifications and requests. This enhances the application's internal communication and event handling. ```C# MediatR Improvements for last version of MediatR (Notifications and Request) Adding MediatR for Memory Bus Messaging ``` -------------------------------- ### FluentValidator for Validation Source: https://github.com/eduardopires/equinoxproject/blob/master/docs/index.md FluentValidator is used for implementing fluent validation rules within the application, ensuring data integrity and consistency. ```C# FluentValidator ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.