├── BrandApplication ├── BrandApplication.API │ ├── appsettings.Development.json │ ├── BrandApplication.API.http │ ├── appsettings.json │ ├── BrandApplication.API.csproj │ ├── Properties │ │ └── launchSettings.json │ ├── Controllers │ │ └── BrandController.cs │ └── Program.cs ├── BrandApplication.Business │ ├── Handlers │ │ ├── Commands │ │ │ └── GetByIdCommand.cs │ │ └── Handlers │ │ │ └── GetByIdHandler.cs │ ├── DTOs │ │ ├── BrandDto.cs │ │ └── ModelDto.cs │ ├── Services │ │ ├── IServices │ │ │ ├── IReadServiceAsync.cs │ │ │ ├── IServiceMappings │ │ │ │ └── MappingInterfaces.cs │ │ │ └── IGenericServiceAsync.cs │ │ ├── Services │ │ │ └── EntityServices.cs │ │ ├── GenericServiceAsync.cs │ │ └── ReadServiceAsync.cs │ ├── Mappings │ │ └── MappingProfile.cs │ ├── BrandApplication.Business.csproj │ └── CustomExceptions │ │ └── EntityNotFoundException.cs ├── BrandApplication.DataAccess │ ├── Interfaces │ │ ├── IUnitOfWork.cs │ │ └── IGenericRepository.cs │ ├── Models │ │ ├── Brand.cs │ │ └── ProductModel.cs │ ├── Repositories │ │ ├── UnitOfWork.cs │ │ └── GenericRepository.cs │ ├── FluentConfiguration │ │ └── Brand_FluentConfiguration.cs │ ├── BrandDbContext.cs │ ├── BrandApplication.DataAccess.csproj │ └── Migrations │ │ ├── 20240212152643_InitialMigration.cs │ │ ├── BrandDbContextModelSnapshot.cs │ │ └── 20240212152643_InitialMigration.Designer.cs └── BrandApplication.sln ├── ReadMe.md ├── LICENSE.md ├── .gitignore └── RepopatternCleanArchitecture.drawio /BrandApplication/BrandApplication.API/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft.AspNetCore": "Warning" 6 | } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /BrandApplication/BrandApplication.API/BrandApplication.API.http: -------------------------------------------------------------------------------- 1 | @BrandApplication.API_HostAddress = http://localhost:5070 2 | 3 | GET {{BrandApplication.API_HostAddress}}/weatherforecast/ 4 | Accept: application/json 5 | 6 | ### 7 | -------------------------------------------------------------------------------- /BrandApplication/BrandApplication.Business/Handlers/Commands/GetByIdCommand.cs: -------------------------------------------------------------------------------- 1 | using MediatR; 2 | 3 | namespace BrandApplication.Business.Handlers.Commands 4 | { 5 | public class GetByIdCommand : IRequest 6 | { 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /BrandApplication/BrandApplication.DataAccess/Interfaces/IUnitOfWork.cs: -------------------------------------------------------------------------------- 1 | namespace BrandApplication.DataAccess.Interfaces 2 | { 3 | public interface IUnitOfWork 4 | { 5 | Task SaveChangesAsync(); 6 | IGenericRepository Repository() where T : class; 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /BrandApplication/BrandApplication.Business/DTOs/BrandDto.cs: -------------------------------------------------------------------------------- 1 | namespace BrandApplication.Business.DTOs 2 | { 3 | public class BrandDto 4 | { 5 | public int BrandId { get; set; } 6 | public string BrandName { get; set; } 7 | 8 | public ICollection Models { get; set; } 9 | 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /BrandApplication/BrandApplication.Business/Services/IServices/IReadServiceAsync.cs: -------------------------------------------------------------------------------- 1 | namespace BrandApplication.Business.Services.IServices 2 | { 3 | public interface IReadServiceAsync where TEntity : class where TDto : class 4 | { 5 | Task> GetAllAsync(); 6 | Task GetByIdAsync(int id); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /BrandApplication/BrandApplication.Business/DTOs/ModelDto.cs: -------------------------------------------------------------------------------- 1 | namespace BrandApplication.Business.DTOs 2 | { 3 | public class ModelDto 4 | { 5 | public int ModelId { get; set; } 6 | public string ModelName { get; set; } 7 | 8 | public int BrandId { get; set; } 9 | public BrandDto Brand { get; set; } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /BrandApplication/BrandApplication.Business/Services/IServices/IServiceMappings/MappingInterfaces.cs: -------------------------------------------------------------------------------- 1 | using BrandApplication.Business.DTOs; 2 | using BrandApplication.DataAccess.Models; 3 | 4 | 5 | namespace BrandApplication.Business.Services.IServices.IServiceMappings 6 | { 7 | 8 | public interface IBrandService: IReadServiceAsync 9 | { 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /BrandApplication/BrandApplication.DataAccess/Models/Brand.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations; 2 | 3 | namespace BrandApplication.DataAccess.Models 4 | { 5 | public class Brand 6 | { 7 | [Key] 8 | public int BrandId { get; set; } 9 | public string BrandName { get; set; } 10 | 11 | public ICollection Models { get; set; } 12 | } 13 | } -------------------------------------------------------------------------------- /BrandApplication/BrandApplication.API/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft.AspNetCore": "Warning" 6 | } 7 | }, 8 | "AllowedHosts": "*", 9 | "ConnectionStrings": { 10 | "DefaultConnection": "Server=localhost\\SQLEXPRESS;Database=RepoPatternDb;TrustServerCertificate=True;Trusted_Connection=True;" 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /BrandApplication/BrandApplication.DataAccess/Models/ProductModel.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations; 2 | 3 | namespace BrandApplication.DataAccess.Models 4 | { 5 | public class ProductModel 6 | { 7 | [Key] 8 | public int ModelId { get; set; } 9 | public string ModelName { get; set; } 10 | 11 | public int BrandId { get; set; } 12 | public Brand Brand { get; set; } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /BrandApplication/BrandApplication.Business/Services/IServices/IGenericServiceAsync.cs: -------------------------------------------------------------------------------- 1 | namespace BrandApplication.Business.Services.IServices 2 | { 3 | public interface IGenericServiceAsync : IReadServiceAsync 4 | where TEntity : class 5 | where TDto : class 6 | 7 | { 8 | Task AddAsync(TDto dto); 9 | Task DeleteAsync(int id); 10 | Task UpdateAsync(TDto dto); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /BrandApplication/BrandApplication.DataAccess/Interfaces/IGenericRepository.cs: -------------------------------------------------------------------------------- 1 | 2 | namespace BrandApplication.DataAccess.Interfaces 3 | { 4 | public interface IGenericRepository where T : class 5 | { 6 | Task AddAsync(T entity); 7 | Task GetByIdAsync(int id); 8 | Task> GetAllAsync(bool tracked = true); 9 | Task UpdateAsync(T entity); 10 | Task DeleteByIdAsync(int id); 11 | Task SaveAsync(); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /BrandApplication/BrandApplication.Business/Mappings/MappingProfile.cs: -------------------------------------------------------------------------------- 1 | using AutoMapper; 2 | using BrandApplication.Business.DTOs; 3 | using BrandApplication.DataAccess.Models; 4 | 5 | namespace BrandApplication.Business.Mappings 6 | { 7 | public class MappingProfile : Profile 8 | { 9 | public MappingProfile() 10 | { 11 | CreateMap().ReverseMap(); 12 | CreateMap().ReverseMap(); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /BrandApplication/BrandApplication.Business/Services/Services/EntityServices.cs: -------------------------------------------------------------------------------- 1 | using AutoMapper; 2 | using BrandApplication.Business.DTOs; 3 | using BrandApplication.Business.Services.IServices.IServiceMappings; 4 | using BrandApplication.DataAccess.Interfaces; 5 | using BrandApplication.DataAccess.Models; 6 | 7 | namespace BrandApplication.Business.Services.ServiceMappings 8 | { 9 | public class BrandService : ReadServiceAsync, IBrandService 10 | { 11 | public BrandService(IUnitOfWork unitOf, IMapper mapper) : base(unitOf, mapper) 12 | { 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /BrandApplication/BrandApplication.Business/BrandApplication.Business.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net8.0 5 | enable 6 | enable 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /BrandApplication/BrandApplication.Business/Handlers/Handlers/GetByIdHandler.cs: -------------------------------------------------------------------------------- 1 | using BrandApplication.Business.Handlers.Commands; 2 | using BrandApplication.Business.Services.IServices; 3 | using MediatR; 4 | 5 | namespace BrandApplication.Business.Handlers.Handlers 6 | { 7 | public class GetByIdHandler : IRequestHandler> where T : class 8 | { 9 | public GetByIdHandler() 10 | { 11 | 12 | } 13 | public Task Handle(GetByIdCommand request, CancellationToken cancellationToken) 14 | { 15 | throw new NotImplementedException(); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /BrandApplication/BrandApplication.DataAccess/Repositories/UnitOfWork.cs: -------------------------------------------------------------------------------- 1 | using BrandApplication.DataAccess.Interfaces; 2 | 3 | namespace BrandApplication.DataAccess.Repositories 4 | { 5 | public class UnitOfWork : IUnitOfWork 6 | { 7 | private readonly BrandDbContext _dbContext; 8 | 9 | public UnitOfWork(BrandDbContext dbContext) 10 | { 11 | _dbContext = dbContext; 12 | } 13 | 14 | public async Task SaveChangesAsync() 15 | { 16 | await _dbContext.SaveChangesAsync(); 17 | } 18 | 19 | public IGenericRepository Repository() where T : class 20 | { 21 | return new GenericRepository(_dbContext); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /BrandApplication/BrandApplication.DataAccess/FluentConfiguration/Brand_FluentConfiguration.cs: -------------------------------------------------------------------------------- 1 | using BrandApplication.DataAccess.Models; 2 | using Microsoft.EntityFrameworkCore; 3 | using Microsoft.EntityFrameworkCore.Metadata.Builders; 4 | 5 | namespace BrandApplication.DataAccess.FluentConfiguration 6 | { 7 | internal class Brand_FluentConfiguration : IEntityTypeConfiguration 8 | { 9 | public void Configure(EntityTypeBuilder modelBuilder) 10 | { 11 | modelBuilder 12 | .HasMany(b => b.Models) 13 | .WithOne(b => b.Brand) 14 | .HasForeignKey(b => b.BrandId) 15 | .OnDelete(DeleteBehavior.Cascade); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /BrandApplication/BrandApplication.Business/CustomExceptions/EntityNotFoundException.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.Serialization; 2 | 3 | namespace Plutus.ProductPricing.Business.CustomExceptions 4 | { 5 | [Serializable] 6 | internal class EntityNotFoundException : Exception 7 | { 8 | public EntityNotFoundException() 9 | { 10 | } 11 | 12 | public EntityNotFoundException(string? message) : base(message) 13 | { 14 | } 15 | 16 | public EntityNotFoundException(string? message, Exception? innerException) : base(message, innerException) 17 | { 18 | } 19 | 20 | protected EntityNotFoundException(SerializationInfo info, StreamingContext context) : base(info, context) 21 | { 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /BrandApplication/BrandApplication.DataAccess/BrandDbContext.cs: -------------------------------------------------------------------------------- 1 | using BrandApplication.DataAccess.Models; 2 | using Microsoft.EntityFrameworkCore; 3 | 4 | namespace BrandApplication.DataAccess 5 | { 6 | public class BrandDbContext : DbContext 7 | { 8 | public BrandDbContext(DbContextOptions options) : base(options) 9 | { 10 | } 11 | 12 | public DbSet Brands { get; set; } 13 | public DbSet Models { get; set; } 14 | 15 | protected override void OnModelCreating(ModelBuilder modelBuilder) 16 | { 17 | modelBuilder.ApplyConfiguration(new FluentConfiguration.Brand_FluentConfiguration()); 18 | modelBuilder.Entity().HasData(new Brand { BrandId = 1, BrandName = "Brand 1" }); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /BrandApplication/BrandApplication.DataAccess/BrandApplication.DataAccess.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net8.0 5 | enable 6 | enable 7 | 8 | 9 | 10 | 11 | 12 | all 13 | runtime; build; native; contentfiles; analyzers; buildtransitive 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /ReadMe.md: -------------------------------------------------------------------------------- 1 | # Repository Pattern with Entity Framework Core 2 | 3 | ## Introduction 4 | This project is a simple example of the Repository pattern with Entity Framework Core. 5 | You can find the tutorial here: [Repository_Pattern_Tutorial](https://medium.com/@codebob75/repository-pattern-c-ultimate-guide-entity-framework-core-clean-architecture-dtos-dependency-6a8d8b444dcb) 6 | 7 | 8 | ## Project setup 9 | 10 | - BrandApplication.API: Presentation layer (also called Outer or External layer) 11 | - BrandApplication.Business: Application layer (also called Service or business layer) 12 | - BrandApplication.DataAccess: Data layer (also called Infrastructure layer) 13 | 14 | ## Background 15 | This project comes in addition to the EF-Core Repo that you can find here : [EF-Core-Repo](https://github.com/Gabegi/EntityFrameworkCoreCodeFirst) 16 | 17 | ## Feedback 18 | Let me know if you have any feedback, suggestions or if you find any issues. 19 | Thank you! 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /BrandApplication/BrandApplication.API/BrandApplication.API.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net8.0 5 | enable 6 | enable 7 | false 8 | 9 | 10 | 11 | 12 | 13 | all 14 | runtime; build; native; contentfiles; analyzers; buildtransitive 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2024 Gabriel Pirastru 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /BrandApplication/BrandApplication.API/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json.schemastore.org/launchsettings.json", 3 | "iisSettings": { 4 | "windowsAuthentication": false, 5 | "anonymousAuthentication": true, 6 | "iisExpress": { 7 | "applicationUrl": "http://localhost:58474", 8 | "sslPort": 44318 9 | } 10 | }, 11 | "profiles": { 12 | "http": { 13 | "commandName": "Project", 14 | "dotnetRunMessages": true, 15 | "launchBrowser": true, 16 | "launchUrl": "swagger", 17 | "applicationUrl": "http://localhost:5070", 18 | "environmentVariables": { 19 | "ASPNETCORE_ENVIRONMENT": "Development" 20 | } 21 | }, 22 | "https": { 23 | "commandName": "Project", 24 | "dotnetRunMessages": true, 25 | "launchBrowser": true, 26 | "launchUrl": "swagger", 27 | "applicationUrl": "https://localhost:7026;http://localhost:5070", 28 | "environmentVariables": { 29 | "ASPNETCORE_ENVIRONMENT": "Development" 30 | } 31 | }, 32 | "IIS Express": { 33 | "commandName": "IISExpress", 34 | "launchBrowser": true, 35 | "launchUrl": "swagger", 36 | "environmentVariables": { 37 | "ASPNETCORE_ENVIRONMENT": "Development" 38 | } 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /BrandApplication/BrandApplication.API/Controllers/BrandController.cs: -------------------------------------------------------------------------------- 1 | using BrandApplication.Business.DTOs; 2 | using BrandApplication.Business.Services.IServices.IServiceMappings; 3 | using Microsoft.AspNetCore.Mvc; 4 | 5 | namespace Plutus.ProductPricing.API.Controllers.Assets_Controllers 6 | { 7 | [Route("api/[controller]")] 8 | [ApiController] 9 | public class BrandController : ControllerBase 10 | { 11 | private readonly IBrandService _service; 12 | 13 | public BrandController(IBrandService service) 14 | { 15 | _service = service; 16 | } 17 | 18 | [HttpGet] 19 | [ProducesResponseType(StatusCodes.Status200OK)] 20 | public async Task>> GetAllBrands() 21 | { 22 | return Ok(await _service.GetAllAsync()); 23 | } 24 | 25 | [HttpGet("{id:int}")] 26 | [ProducesResponseType(StatusCodes.Status200OK)] 27 | [ProducesResponseType(StatusCodes.Status404NotFound)] 28 | [ProducesResponseType(StatusCodes.Status400BadRequest)] 29 | public async Task> GetBrandByID(int id) 30 | { 31 | if (id < 1) 32 | { 33 | return BadRequest("Id must be greater than 0"); 34 | } 35 | 36 | return Ok(await _service.GetByIdAsync(id)); 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /BrandApplication/BrandApplication.Business/Services/GenericServiceAsync.cs: -------------------------------------------------------------------------------- 1 | using AutoMapper; 2 | using BrandApplication.Business.Services.IServices; 3 | using BrandApplication.DataAccess.Interfaces; 4 | 5 | namespace BrandApplication.Business.Services 6 | { 7 | public class GenericServiceAsync : ReadServiceAsync, IGenericServiceAsync 8 | where TEntity : class 9 | where TDto : class 10 | { 11 | private readonly IMapper _mapper; 12 | private readonly IUnitOfWork _unitOfWork; 13 | 14 | 15 | public GenericServiceAsync(IUnitOfWork unitOfWork, IMapper mapper) : base(unitOfWork, mapper) 16 | { 17 | _unitOfWork = unitOfWork; 18 | _mapper = mapper; 19 | } 20 | 21 | public async Task AddAsync(TDto dto) 22 | { 23 | await _unitOfWork.Repository().AddAsync(_mapper.Map(dto)); 24 | await _unitOfWork.SaveChangesAsync(); 25 | } 26 | 27 | public async Task DeleteAsync(int id) 28 | { 29 | await _unitOfWork.Repository().DeleteByIdAsync(id); 30 | await _unitOfWork.SaveChangesAsync(); 31 | } 32 | 33 | public async Task UpdateAsync(TDto dto) 34 | { 35 | var entity = _mapper.Map(dto); 36 | await _unitOfWork.Repository().UpdateAsync(entity); 37 | await _unitOfWork.SaveChangesAsync(); 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /BrandApplication/BrandApplication.DataAccess/Repositories/GenericRepository.cs: -------------------------------------------------------------------------------- 1 | using BrandApplication.DataAccess.Interfaces; 2 | using Microsoft.EntityFrameworkCore; 3 | 4 | namespace BrandApplication.DataAccess.Repositories 5 | { 6 | public class GenericRepository : IGenericRepository where T : class 7 | { 8 | private readonly BrandDbContext _databaseContext; 9 | private readonly DbSet _dbSet; 10 | 11 | public GenericRepository(BrandDbContext context) 12 | { 13 | _databaseContext = context; 14 | _dbSet = context.Set(); 15 | } 16 | 17 | public async Task AddAsync(T entity) 18 | { 19 | await _dbSet.AddAsync(entity); 20 | await SaveAsync(); 21 | } 22 | 23 | public async Task DeleteByIdAsync(int id) 24 | { 25 | var entityToDelete = await _dbSet.FindAsync(id); 26 | 27 | if (entityToDelete != null) 28 | { 29 | _dbSet.Remove(entityToDelete); 30 | await SaveAsync(); 31 | } 32 | } 33 | public async Task GetByIdAsync(int id) 34 | { 35 | return await _dbSet.FindAsync(id); 36 | } 37 | 38 | public async Task> GetAllAsync(bool tracked = true) 39 | { 40 | IQueryable query = _dbSet; 41 | 42 | if (!tracked) 43 | { 44 | query = query.AsNoTracking(); 45 | } 46 | 47 | return await query.ToListAsync(); 48 | } 49 | 50 | public async Task UpdateAsync(T entity) 51 | { 52 | _dbSet.Update(entity); 53 | await SaveAsync(); 54 | } 55 | 56 | public async Task SaveAsync() 57 | { 58 | await _databaseContext.SaveChangesAsync(); 59 | } 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /BrandApplication/BrandApplication.API/Program.cs: -------------------------------------------------------------------------------- 1 | using BrandApplication.Business.Mappings; 2 | using BrandApplication.Business.Services.IServices; 3 | using BrandApplication.Business.Services; 4 | using BrandApplication.DataAccess; 5 | using BrandApplication.DataAccess.Interfaces; 6 | using BrandApplication.DataAccess.Repositories; 7 | using Microsoft.EntityFrameworkCore; 8 | using BrandApplication.Business.Services.IServices.IServiceMappings; 9 | using BrandApplication.Business.Services.ServiceMappings; 10 | 11 | var builder = WebApplication.CreateBuilder(args); 12 | 13 | // Add services to the container. 14 | 15 | builder.Services.AddControllers(); 16 | // Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle 17 | builder.Services.AddEndpointsApiExplorer(); 18 | builder.Services.AddSwaggerGen(); 19 | 20 | 21 | ///// Data Base Configuration 22 | builder.Services.AddScoped(); 23 | 24 | builder.Services.AddDbContext(options => 25 | { 26 | options.UseSqlServer( 27 | builder.Configuration.GetConnectionString("DefaultConnection"), 28 | sqlServerOptionsAction: sqlOptions => 29 | { 30 | sqlOptions.MigrationsAssembly("BrandApplication.DataAccess"); 31 | }); 32 | }); 33 | 34 | //// AutoMapper Configuration 35 | builder.Services.AddAutoMapper(typeof(MappingProfile)); 36 | 37 | //// Generic Repository & Unit of Work 38 | builder.Services.AddScoped(typeof(IGenericRepository<>), typeof(GenericRepository<>)); 39 | builder.Services.AddScoped(); 40 | 41 | //// Generic Services 42 | builder.Services.AddScoped(typeof(IReadServiceAsync<,>), typeof(ReadServiceAsync<,>)); 43 | builder.Services.AddScoped(typeof(IGenericServiceAsync<,>), typeof(GenericServiceAsync<,>)); 44 | 45 | //////////////////////////////////// Services //////////////////////////////////// 46 | 47 | // Asset Mappings 48 | builder.Services.AddScoped(typeof(IBrandService), typeof(BrandService)); 49 | 50 | 51 | var app = builder.Build(); 52 | 53 | // Configure the HTTP request pipeline. 54 | if (app.Environment.IsDevelopment()) 55 | { 56 | app.UseSwagger(); 57 | app.UseSwaggerUI(); 58 | } 59 | 60 | app.UseHttpsRedirection(); 61 | 62 | app.UseAuthorization(); 63 | 64 | app.MapControllers(); 65 | 66 | app.Run(); 67 | -------------------------------------------------------------------------------- /BrandApplication/BrandApplication.Business/Services/ReadServiceAsync.cs: -------------------------------------------------------------------------------- 1 | using AutoMapper; 2 | using BrandApplication.Business.Services.IServices; 3 | using BrandApplication.DataAccess.Interfaces; 4 | using Plutus.ProductPricing.Business.CustomExceptions; 5 | 6 | 7 | namespace BrandApplication.Business.Services 8 | { 9 | public class ReadServiceAsync : IReadServiceAsync 10 | where TEntity : class 11 | where TDto : class 12 | { 13 | private readonly IUnitOfWork _unitOfWork; 14 | private readonly IMapper _mapper; 15 | 16 | public ReadServiceAsync(IUnitOfWork unitOfWork, IMapper mapper) : base() 17 | { 18 | _unitOfWork = unitOfWork; 19 | _mapper = mapper; 20 | } 21 | public async Task> GetAllAsync() 22 | { 23 | try 24 | { 25 | var result = await _unitOfWork.Repository().GetAllAsync(); 26 | 27 | if (result.Any()) 28 | { 29 | return _mapper.Map>(result); 30 | } 31 | else 32 | { 33 | throw new EntityNotFoundException($"No {typeof(TDto).Name}s were found"); 34 | } 35 | 36 | } 37 | catch (EntityNotFoundException ex) 38 | { 39 | var message = $"Error retrieving all {typeof(TDto).Name}s"; 40 | 41 | throw new EntityNotFoundException(message, ex); 42 | } 43 | } 44 | 45 | public async Task GetByIdAsync(int id) 46 | { 47 | try 48 | { 49 | var result = await _unitOfWork.Repository().GetByIdAsync(id); 50 | 51 | if (result is null) 52 | { 53 | throw new EntityNotFoundException($"Entity with ID {id} not found."); 54 | } 55 | 56 | return _mapper.Map(result); 57 | } 58 | 59 | catch (EntityNotFoundException ex) 60 | { 61 | var message = $"Error retrieving {typeof(TDto).Name} with Id: {id}"; 62 | 63 | throw new EntityNotFoundException(message, ex); 64 | } 65 | } 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /BrandApplication/BrandApplication.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.8.34408.163 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BrandApplication.API", "BrandApplication.API\BrandApplication.API.csproj", "{8D974E58-A20C-44EF-B77E-06D50E99A07C}" 7 | EndProject 8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BrandApplication.Business", "BrandApplication.Business\BrandApplication.Business.csproj", "{7BA02EE2-C122-47F7-899C-E400A04D44F5}" 9 | EndProject 10 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BrandApplication.DataAccess", "BrandApplication.DataAccess\BrandApplication.DataAccess.csproj", "{1D551493-6070-44B3-9FB2-DB25B435AEAB}" 11 | EndProject 12 | Global 13 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 14 | Debug|Any CPU = Debug|Any CPU 15 | Release|Any CPU = Release|Any CPU 16 | EndGlobalSection 17 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 18 | {8D974E58-A20C-44EF-B77E-06D50E99A07C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 19 | {8D974E58-A20C-44EF-B77E-06D50E99A07C}.Debug|Any CPU.Build.0 = Debug|Any CPU 20 | {8D974E58-A20C-44EF-B77E-06D50E99A07C}.Release|Any CPU.ActiveCfg = Release|Any CPU 21 | {8D974E58-A20C-44EF-B77E-06D50E99A07C}.Release|Any CPU.Build.0 = Release|Any CPU 22 | {7BA02EE2-C122-47F7-899C-E400A04D44F5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 23 | {7BA02EE2-C122-47F7-899C-E400A04D44F5}.Debug|Any CPU.Build.0 = Debug|Any CPU 24 | {7BA02EE2-C122-47F7-899C-E400A04D44F5}.Release|Any CPU.ActiveCfg = Release|Any CPU 25 | {7BA02EE2-C122-47F7-899C-E400A04D44F5}.Release|Any CPU.Build.0 = Release|Any CPU 26 | {1D551493-6070-44B3-9FB2-DB25B435AEAB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 27 | {1D551493-6070-44B3-9FB2-DB25B435AEAB}.Debug|Any CPU.Build.0 = Debug|Any CPU 28 | {1D551493-6070-44B3-9FB2-DB25B435AEAB}.Release|Any CPU.ActiveCfg = Release|Any CPU 29 | {1D551493-6070-44B3-9FB2-DB25B435AEAB}.Release|Any CPU.Build.0 = Release|Any CPU 30 | EndGlobalSection 31 | GlobalSection(SolutionProperties) = preSolution 32 | HideSolutionNode = FALSE 33 | EndGlobalSection 34 | GlobalSection(ExtensibilityGlobals) = postSolution 35 | SolutionGuid = {7E21AC6B-283A-4E07-8BB0-3B93BDA55302} 36 | EndGlobalSection 37 | EndGlobal 38 | -------------------------------------------------------------------------------- /BrandApplication/BrandApplication.DataAccess/Migrations/20240212152643_InitialMigration.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.EntityFrameworkCore.Migrations; 2 | 3 | #nullable disable 4 | 5 | namespace BrandApplication.DataAccess.Migrations 6 | { 7 | /// 8 | public partial class InitialMigration : Migration 9 | { 10 | /// 11 | protected override void Up(MigrationBuilder migrationBuilder) 12 | { 13 | migrationBuilder.CreateTable( 14 | name: "Brands", 15 | columns: table => new 16 | { 17 | BrandId = table.Column(type: "int", nullable: false) 18 | .Annotation("SqlServer:Identity", "1, 1"), 19 | BrandName = table.Column(type: "nvarchar(max)", nullable: false) 20 | }, 21 | constraints: table => 22 | { 23 | table.PrimaryKey("PK_Brands", x => x.BrandId); 24 | }); 25 | 26 | migrationBuilder.CreateTable( 27 | name: "Models", 28 | columns: table => new 29 | { 30 | ModelId = table.Column(type: "int", nullable: false) 31 | .Annotation("SqlServer:Identity", "1, 1"), 32 | ModelName = table.Column(type: "nvarchar(max)", nullable: false), 33 | BrandId = table.Column(type: "int", nullable: false) 34 | }, 35 | constraints: table => 36 | { 37 | table.PrimaryKey("PK_Models", x => x.ModelId); 38 | table.ForeignKey( 39 | name: "FK_Models_Brands_BrandId", 40 | column: x => x.BrandId, 41 | principalTable: "Brands", 42 | principalColumn: "BrandId", 43 | onDelete: ReferentialAction.Cascade); 44 | }); 45 | 46 | migrationBuilder.InsertData( 47 | table: "Brands", 48 | columns: new[] { "BrandId", "BrandName" }, 49 | values: new object[] { 1, "Brand 1" }); 50 | 51 | migrationBuilder.CreateIndex( 52 | name: "IX_Models_BrandId", 53 | table: "Models", 54 | column: "BrandId"); 55 | } 56 | 57 | /// 58 | protected override void Down(MigrationBuilder migrationBuilder) 59 | { 60 | migrationBuilder.DropTable( 61 | name: "Models"); 62 | 63 | migrationBuilder.DropTable( 64 | name: "Brands"); 65 | } 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /BrandApplication/BrandApplication.DataAccess/Migrations/BrandDbContextModelSnapshot.cs: -------------------------------------------------------------------------------- 1 | // 2 | using BrandApplication.DataAccess; 3 | using Microsoft.EntityFrameworkCore; 4 | using Microsoft.EntityFrameworkCore.Infrastructure; 5 | using Microsoft.EntityFrameworkCore.Metadata; 6 | using Microsoft.EntityFrameworkCore.Storage.ValueConversion; 7 | 8 | #nullable disable 9 | 10 | namespace BrandApplication.DataAccess.Migrations 11 | { 12 | [DbContext(typeof(BrandDbContext))] 13 | partial class BrandDbContextModelSnapshot : ModelSnapshot 14 | { 15 | protected override void BuildModel(ModelBuilder modelBuilder) 16 | { 17 | #pragma warning disable 612, 618 18 | modelBuilder 19 | .HasAnnotation("ProductVersion", "8.0.1") 20 | .HasAnnotation("Relational:MaxIdentifierLength", 128); 21 | 22 | SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); 23 | 24 | modelBuilder.Entity("BrandApplication.DataAccess.Models.Brand", b => 25 | { 26 | b.Property("BrandId") 27 | .ValueGeneratedOnAdd() 28 | .HasColumnType("int"); 29 | 30 | SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("BrandId")); 31 | 32 | b.Property("BrandName") 33 | .IsRequired() 34 | .HasColumnType("nvarchar(max)"); 35 | 36 | b.HasKey("BrandId"); 37 | 38 | b.ToTable("Brands"); 39 | 40 | b.HasData( 41 | new 42 | { 43 | BrandId = 1, 44 | BrandName = "Brand 1" 45 | }); 46 | }); 47 | 48 | modelBuilder.Entity("BrandApplication.DataAccess.Models.ProductModel", b => 49 | { 50 | b.Property("ModelId") 51 | .ValueGeneratedOnAdd() 52 | .HasColumnType("int"); 53 | 54 | SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("ModelId")); 55 | 56 | b.Property("BrandId") 57 | .HasColumnType("int"); 58 | 59 | b.Property("ModelName") 60 | .IsRequired() 61 | .HasColumnType("nvarchar(max)"); 62 | 63 | b.HasKey("ModelId"); 64 | 65 | b.HasIndex("BrandId"); 66 | 67 | b.ToTable("Models"); 68 | }); 69 | 70 | modelBuilder.Entity("BrandApplication.DataAccess.Models.ProductModel", b => 71 | { 72 | b.HasOne("BrandApplication.DataAccess.Models.Brand", "Brand") 73 | .WithMany("Models") 74 | .HasForeignKey("BrandId") 75 | .OnDelete(DeleteBehavior.Cascade) 76 | .IsRequired(); 77 | 78 | b.Navigation("Brand"); 79 | }); 80 | 81 | modelBuilder.Entity("BrandApplication.DataAccess.Models.Brand", b => 82 | { 83 | b.Navigation("Models"); 84 | }); 85 | #pragma warning restore 612, 618 86 | } 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /BrandApplication/BrandApplication.DataAccess/Migrations/20240212152643_InitialMigration.Designer.cs: -------------------------------------------------------------------------------- 1 | // 2 | using BrandApplication.DataAccess; 3 | using Microsoft.EntityFrameworkCore; 4 | using Microsoft.EntityFrameworkCore.Infrastructure; 5 | using Microsoft.EntityFrameworkCore.Metadata; 6 | using Microsoft.EntityFrameworkCore.Migrations; 7 | using Microsoft.EntityFrameworkCore.Storage.ValueConversion; 8 | 9 | #nullable disable 10 | 11 | namespace BrandApplication.DataAccess.Migrations 12 | { 13 | [DbContext(typeof(BrandDbContext))] 14 | [Migration("20240212152643_InitialMigration")] 15 | partial class InitialMigration 16 | { 17 | /// 18 | protected override void BuildTargetModel(ModelBuilder modelBuilder) 19 | { 20 | #pragma warning disable 612, 618 21 | modelBuilder 22 | .HasAnnotation("ProductVersion", "8.0.1") 23 | .HasAnnotation("Relational:MaxIdentifierLength", 128); 24 | 25 | SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); 26 | 27 | modelBuilder.Entity("BrandApplication.DataAccess.Models.Brand", b => 28 | { 29 | b.Property("BrandId") 30 | .ValueGeneratedOnAdd() 31 | .HasColumnType("int"); 32 | 33 | SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("BrandId")); 34 | 35 | b.Property("BrandName") 36 | .IsRequired() 37 | .HasColumnType("nvarchar(max)"); 38 | 39 | b.HasKey("BrandId"); 40 | 41 | b.ToTable("Brands"); 42 | 43 | b.HasData( 44 | new 45 | { 46 | BrandId = 1, 47 | BrandName = "Brand 1" 48 | }); 49 | }); 50 | 51 | modelBuilder.Entity("BrandApplication.DataAccess.Models.ProductModel", b => 52 | { 53 | b.Property("ModelId") 54 | .ValueGeneratedOnAdd() 55 | .HasColumnType("int"); 56 | 57 | SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("ModelId")); 58 | 59 | b.Property("BrandId") 60 | .HasColumnType("int"); 61 | 62 | b.Property("ModelName") 63 | .IsRequired() 64 | .HasColumnType("nvarchar(max)"); 65 | 66 | b.HasKey("ModelId"); 67 | 68 | b.HasIndex("BrandId"); 69 | 70 | b.ToTable("Models"); 71 | }); 72 | 73 | modelBuilder.Entity("BrandApplication.DataAccess.Models.ProductModel", b => 74 | { 75 | b.HasOne("BrandApplication.DataAccess.Models.Brand", "Brand") 76 | .WithMany("Models") 77 | .HasForeignKey("BrandId") 78 | .OnDelete(DeleteBehavior.Cascade) 79 | .IsRequired(); 80 | 81 | b.Navigation("Brand"); 82 | }); 83 | 84 | modelBuilder.Entity("BrandApplication.DataAccess.Models.Brand", b => 85 | { 86 | b.Navigation("Models"); 87 | }); 88 | #pragma warning restore 612, 618 89 | } 90 | } 91 | } 92 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | ## 4 | ## Get latest from `dotnet new gitignore` 5 | 6 | # dotenv files 7 | .env 8 | 9 | # User-specific files 10 | *.rsuser 11 | *.suo 12 | *.user 13 | *.userosscache 14 | *.sln.docstates 15 | 16 | # User-specific files (MonoDevelop/Xamarin Studio) 17 | *.userprefs 18 | 19 | # Mono auto generated files 20 | mono_crash.* 21 | 22 | # Build results 23 | [Dd]ebug/ 24 | [Dd]ebugPublic/ 25 | [Rr]elease/ 26 | [Rr]eleases/ 27 | x64/ 28 | x86/ 29 | [Ww][Ii][Nn]32/ 30 | [Aa][Rr][Mm]/ 31 | [Aa][Rr][Mm]64/ 32 | bld/ 33 | [Bb]in/ 34 | [Oo]bj/ 35 | [Ll]og/ 36 | [Ll]ogs/ 37 | 38 | # Visual Studio 2015/2017 cache/options directory 39 | .vs/ 40 | # Uncomment if you have tasks that create the project's static files in wwwroot 41 | #wwwroot/ 42 | 43 | # Visual Studio 2017 auto generated files 44 | Generated\ Files/ 45 | 46 | # MSTest test Results 47 | [Tt]est[Rr]esult*/ 48 | [Bb]uild[Ll]og.* 49 | 50 | # NUnit 51 | *.VisualState.xml 52 | TestResult.xml 53 | nunit-*.xml 54 | 55 | # Build Results of an ATL Project 56 | [Dd]ebugPS/ 57 | [Rr]eleasePS/ 58 | dlldata.c 59 | 60 | # Benchmark Results 61 | BenchmarkDotNet.Artifacts/ 62 | 63 | # .NET 64 | project.lock.json 65 | project.fragment.lock.json 66 | artifacts/ 67 | 68 | # Tye 69 | .tye/ 70 | 71 | # ASP.NET Scaffolding 72 | ScaffoldingReadMe.txt 73 | 74 | # StyleCop 75 | StyleCopReport.xml 76 | 77 | # Files built by Visual Studio 78 | *_i.c 79 | *_p.c 80 | *_h.h 81 | *.ilk 82 | *.meta 83 | *.obj 84 | *.iobj 85 | *.pch 86 | *.pdb 87 | *.ipdb 88 | *.pgc 89 | *.pgd 90 | *.rsp 91 | *.sbr 92 | *.tlb 93 | *.tli 94 | *.tlh 95 | *.tmp 96 | *.tmp_proj 97 | *_wpftmp.csproj 98 | *.log 99 | *.tlog 100 | *.vspscc 101 | *.vssscc 102 | .builds 103 | *.pidb 104 | *.svclog 105 | *.scc 106 | 107 | # Chutzpah Test files 108 | _Chutzpah* 109 | 110 | # Visual C++ cache files 111 | ipch/ 112 | *.aps 113 | *.ncb 114 | *.opendb 115 | *.opensdf 116 | *.sdf 117 | *.cachefile 118 | *.VC.db 119 | *.VC.VC.opendb 120 | 121 | # Visual Studio profiler 122 | *.psess 123 | *.vsp 124 | *.vspx 125 | *.sap 126 | 127 | # Visual Studio Trace Files 128 | *.e2e 129 | 130 | # TFS 2012 Local Workspace 131 | $tf/ 132 | 133 | # Guidance Automation Toolkit 134 | *.gpState 135 | 136 | # ReSharper is a .NET coding add-in 137 | _ReSharper*/ 138 | *.[Rr]e[Ss]harper 139 | *.DotSettings.user 140 | 141 | # TeamCity is a build add-in 142 | _TeamCity* 143 | 144 | # DotCover is a Code Coverage Tool 145 | *.dotCover 146 | 147 | # AxoCover is a Code Coverage Tool 148 | .axoCover/* 149 | !.axoCover/settings.json 150 | 151 | # Coverlet is a free, cross platform Code Coverage Tool 152 | coverage*.json 153 | coverage*.xml 154 | coverage*.info 155 | 156 | # Visual Studio code coverage results 157 | *.coverage 158 | *.coveragexml 159 | 160 | # NCrunch 161 | _NCrunch_* 162 | .*crunch*.local.xml 163 | nCrunchTemp_* 164 | 165 | # MightyMoose 166 | *.mm.* 167 | AutoTest.Net/ 168 | 169 | # Web workbench (sass) 170 | .sass-cache/ 171 | 172 | # Installshield output folder 173 | [Ee]xpress/ 174 | 175 | # DocProject is a documentation generator add-in 176 | DocProject/buildhelp/ 177 | DocProject/Help/*.HxT 178 | DocProject/Help/*.HxC 179 | DocProject/Help/*.hhc 180 | DocProject/Help/*.hhk 181 | DocProject/Help/*.hhp 182 | DocProject/Help/Html2 183 | DocProject/Help/html 184 | 185 | # Click-Once directory 186 | publish/ 187 | 188 | # Publish Web Output 189 | *.[Pp]ublish.xml 190 | *.azurePubxml 191 | # Note: Comment the next line if you want to checkin your web deploy settings, 192 | # but database connection strings (with potential passwords) will be unencrypted 193 | *.pubxml 194 | *.publishproj 195 | 196 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 197 | # checkin your Azure Web App publish settings, but sensitive information contained 198 | # in these scripts will be unencrypted 199 | PublishScripts/ 200 | 201 | # NuGet Packages 202 | *.nupkg 203 | # NuGet Symbol Packages 204 | *.snupkg 205 | # The packages folder can be ignored because of Package Restore 206 | **/[Pp]ackages/* 207 | # except build/, which is used as an MSBuild target. 208 | !**/[Pp]ackages/build/ 209 | # Uncomment if necessary however generally it will be regenerated when needed 210 | #!**/[Pp]ackages/repositories.config 211 | # NuGet v3's project.json files produces more ignorable files 212 | *.nuget.props 213 | *.nuget.targets 214 | 215 | # Microsoft Azure Build Output 216 | csx/ 217 | *.build.csdef 218 | 219 | # Microsoft Azure Emulator 220 | ecf/ 221 | rcf/ 222 | 223 | # Windows Store app package directories and files 224 | AppPackages/ 225 | BundleArtifacts/ 226 | Package.StoreAssociation.xml 227 | _pkginfo.txt 228 | *.appx 229 | *.appxbundle 230 | *.appxupload 231 | 232 | # Visual Studio cache files 233 | # files ending in .cache can be ignored 234 | *.[Cc]ache 235 | # but keep track of directories ending in .cache 236 | !?*.[Cc]ache/ 237 | 238 | # Others 239 | ClientBin/ 240 | ~$* 241 | *~ 242 | *.dbmdl 243 | *.dbproj.schemaview 244 | *.jfm 245 | *.pfx 246 | *.publishsettings 247 | orleans.codegen.cs 248 | 249 | # Including strong name files can present a security risk 250 | # (https://github.com/github/gitignore/pull/2483#issue-259490424) 251 | #*.snk 252 | 253 | # Since there are multiple workflows, uncomment next line to ignore bower_components 254 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 255 | #bower_components/ 256 | 257 | # RIA/Silverlight projects 258 | Generated_Code/ 259 | 260 | # Backup & report files from converting an old project file 261 | # to a newer Visual Studio version. Backup files are not needed, 262 | # because we have git ;-) 263 | _UpgradeReport_Files/ 264 | Backup*/ 265 | UpgradeLog*.XML 266 | UpgradeLog*.htm 267 | ServiceFabricBackup/ 268 | *.rptproj.bak 269 | 270 | # SQL Server files 271 | *.mdf 272 | *.ldf 273 | *.ndf 274 | 275 | # Business Intelligence projects 276 | *.rdl.data 277 | *.bim.layout 278 | *.bim_*.settings 279 | *.rptproj.rsuser 280 | *- [Bb]ackup.rdl 281 | *- [Bb]ackup ([0-9]).rdl 282 | *- [Bb]ackup ([0-9][0-9]).rdl 283 | 284 | # Microsoft Fakes 285 | FakesAssemblies/ 286 | 287 | # GhostDoc plugin setting file 288 | *.GhostDoc.xml 289 | 290 | # Node.js Tools for Visual Studio 291 | .ntvs_analysis.dat 292 | node_modules/ 293 | 294 | # Visual Studio 6 build log 295 | *.plg 296 | 297 | # Visual Studio 6 workspace options file 298 | *.opt 299 | 300 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) 301 | *.vbw 302 | 303 | # Visual Studio 6 auto-generated project file (contains which files were open etc.) 304 | *.vbp 305 | 306 | # Visual Studio 6 workspace and project file (working project files containing files to include in project) 307 | *.dsw 308 | *.dsp 309 | 310 | # Visual Studio 6 technical files 311 | *.ncb 312 | *.aps 313 | 314 | # Visual Studio LightSwitch build output 315 | **/*.HTMLClient/GeneratedArtifacts 316 | **/*.DesktopClient/GeneratedArtifacts 317 | **/*.DesktopClient/ModelManifest.xml 318 | **/*.Server/GeneratedArtifacts 319 | **/*.Server/ModelManifest.xml 320 | _Pvt_Extensions 321 | 322 | # Paket dependency manager 323 | .paket/paket.exe 324 | paket-files/ 325 | 326 | # FAKE - F# Make 327 | .fake/ 328 | 329 | # CodeRush personal settings 330 | .cr/personal 331 | 332 | # Python Tools for Visual Studio (PTVS) 333 | __pycache__/ 334 | *.pyc 335 | 336 | # Cake - Uncomment if you are using it 337 | # tools/** 338 | # !tools/packages.config 339 | 340 | # Tabs Studio 341 | *.tss 342 | 343 | # Telerik's JustMock configuration file 344 | *.jmconfig 345 | 346 | # BizTalk build output 347 | *.btp.cs 348 | *.btm.cs 349 | *.odx.cs 350 | *.xsd.cs 351 | 352 | # OpenCover UI analysis results 353 | OpenCover/ 354 | 355 | # Azure Stream Analytics local run output 356 | ASALocalRun/ 357 | 358 | # MSBuild Binary and Structured Log 359 | *.binlog 360 | 361 | # NVidia Nsight GPU debugger configuration file 362 | *.nvuser 363 | 364 | # MFractors (Xamarin productivity tool) working folder 365 | .mfractor/ 366 | 367 | # Local History for Visual Studio 368 | .localhistory/ 369 | 370 | # Visual Studio History (VSHistory) files 371 | .vshistory/ 372 | 373 | # BeatPulse healthcheck temp database 374 | healthchecksdb 375 | 376 | # Backup folder for Package Reference Convert tool in Visual Studio 2017 377 | MigrationBackup/ 378 | 379 | # Ionide (cross platform F# VS Code tools) working folder 380 | .ionide/ 381 | 382 | # Fody - auto-generated XML schema 383 | FodyWeavers.xsd 384 | 385 | # VS Code files for those working on multiple tools 386 | .vscode/* 387 | !.vscode/settings.json 388 | !.vscode/tasks.json 389 | !.vscode/launch.json 390 | !.vscode/extensions.json 391 | *.code-workspace 392 | 393 | # Local History for Visual Studio Code 394 | .history/ 395 | 396 | # Windows Installer files from build outputs 397 | *.cab 398 | *.msi 399 | *.msix 400 | *.msm 401 | *.msp 402 | 403 | # JetBrains Rider 404 | *.sln.iml 405 | .idea 406 | 407 | ## 408 | ## Visual studio for Mac 409 | ## 410 | 411 | 412 | # globs 413 | Makefile.in 414 | *.userprefs 415 | *.usertasks 416 | config.make 417 | config.status 418 | aclocal.m4 419 | install-sh 420 | autom4te.cache/ 421 | *.tar.gz 422 | tarballs/ 423 | test-results/ 424 | 425 | # Mac bundle stuff 426 | *.dmg 427 | *.app 428 | 429 | # content below from: https://github.com/github/gitignore/blob/master/Global/macOS.gitignore 430 | # General 431 | .DS_Store 432 | .AppleDouble 433 | .LSOverride 434 | 435 | # Icon must end with two \r 436 | Icon 437 | 438 | 439 | # Thumbnails 440 | ._* 441 | 442 | # Files that might appear in the root of a volume 443 | .DocumentRevisions-V100 444 | .fseventsd 445 | .Spotlight-V100 446 | .TemporaryItems 447 | .Trashes 448 | .VolumeIcon.icns 449 | .com.apple.timemachine.donotpresent 450 | 451 | # Directories potentially created on remote AFP share 452 | .AppleDB 453 | .AppleDesktop 454 | Network Trash Folder 455 | Temporary Items 456 | .apdisk 457 | 458 | # content below from: https://github.com/github/gitignore/blob/master/Global/Windows.gitignore 459 | # Windows thumbnail cache files 460 | Thumbs.db 461 | ehthumbs.db 462 | ehthumbs_vista.db 463 | 464 | # Dump file 465 | *.stackdump 466 | 467 | # Folder config file 468 | [Dd]esktop.ini 469 | 470 | # Recycle Bin used on file shares 471 | $RECYCLE.BIN/ 472 | 473 | # Windows Installer files 474 | *.cab 475 | *.msi 476 | *.msix 477 | *.msm 478 | *.msp 479 | 480 | # Windows shortcuts 481 | *.lnk 482 | 483 | # Vim temporary swap files 484 | *.swp 485 | -------------------------------------------------------------------------------- /RepopatternCleanArchitecture.drawio: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | --------------------------------------------------------------------------------