π― Sprint 1 - Task 1: Create Clean Architecture Project Structure
Epic: #121
Sprint: 1 (2 weeks)
Estimated Effort: 5 days
π Description
Create the foundational project structure for Clean Architecture migration. This involves setting up separate class library projects for each layer and establishing proper dependency relationships.
ποΈ Architecture Overview
New Project Structure
Solution: Refhub.sln
βββ src/
β βββ Refhub.Domain/ # Class Library (.NET 9)
β βββ Refhub.Application/ # Class Library (.NET 9)
β βββ Refhub.Infrastructure/ # Class Library (.NET 9)
β βββ Refhub.Web/ # Web App (.NET 9)
βββ tests/
βββ Refhub.Domain.Tests/ # xUnit Test Project
βββ Refhub.Application.Tests/ # xUnit Test Project
βββ Refhub.Infrastructure.Tests/# xUnit Test Project
βββ Refhub.Web.Tests/ # xUnit Test Project
Dependency Flow (Clean Architecture Rules)
Refhub.Web β Refhub.Application β Refhub.Domain
β β
Refhub.Infrastructure βββββββ
No project should reference projects to its right or below
β
Acceptance Criteria
1. Project Structure Setup
2. Project References Configuration
3. Basic Folder Structure
Refhub.Domain/
βββ Entities/
βββ ValueObjects/
βββ Interfaces/
βββ Specifications/
βββ Events/
βββ Common/
Refhub.Application/
βββ Commands/
βββ Queries/
βββ DTOs/
βββ Interfaces/
βββ Services/
βββ Validators/
βββ Common/
Refhub.Infrastructure/
βββ Data/
β βββ Context/
β βββ Configurations/
β βββ Repositories/
βββ Services/
βββ Migrations/
βββ Common/
Refhub.Web/
βββ Controllers/
βββ Areas/
βββ Models/
βββ wwwroot/
βββ Configuration/
4. Package Dependencies
π¦ Required NuGet Packages
Refhub.Domain
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="9.0.5" />
Refhub.Application
<PackageReference Include="MediatR" Version="12.4.1" />
<PackageReference Include="FluentValidation.DependencyInjectionExtensions" Version="11.8.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="9.0.5" />
Refhub.Infrastructure
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="9.0.5" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="9.0.5" />
<PackageReference Include="AWSSDK.S3" Version="4.0.4.2" />
Refhub.Web (Existing packages + new ones)
<PackageReference Include="MediatR" Version="12.4.1" />
<PackageReference Include="FluentValidation.AspNetCore" Version="11.3.0" />
π§ Implementation Steps
Day 1-2: Project Creation and Structure
-
Create new class library projects
# Navigate to solution root
cd c:\Users\Hootan\source\repos\Refhub
# Create new projects
dotnet new classlib -n Refhub.Domain -o src/Refhub.Domain
dotnet new classlib -n Refhub.Application -o src/Refhub.Application
dotnet new classlib -n Refhub.Infrastructure -o src/Refhub.Infrastructure
# Create test projects
dotnet new xunit -n Refhub.Domain.Tests -o tests/Refhub.Domain.Tests
dotnet new xunit -n Refhub.Application.Tests -o tests/Refhub.Application.Tests
dotnet new xunit -n Refhub.Infrastructure.Tests -o tests/Refhub.Infrastructure.Tests
dotnet new xunit -n Refhub.Web.Tests -o tests/Refhub.Web.Tests
-
Update solution file
# Add projects to solution
dotnet sln add src/Refhub.Domain/Refhub.Domain.csproj
dotnet sln add src/Refhub.Application/Refhub.Application.csproj
dotnet sln add src/Refhub.Infrastructure/Refhub.Infrastructure.csproj
dotnet sln add tests/Refhub.Domain.Tests/Refhub.Domain.Tests.csproj
dotnet sln add tests/Refhub.Application.Tests/Refhub.Application.Tests.csproj
dotnet sln add tests/Refhub.Infrastructure.Tests/Refhub.Infrastructure.Tests.csproj
dotnet sln add tests/Refhub.Web.Tests/Refhub.Web.Tests.csproj
Day 3: Configure Project References
# Application references Domain
dotnet add src/Refhub.Application/Refhub.Application.csproj reference src/Refhub.Domain/Refhub.Domain.csproj
# Infrastructure references Domain and Application
dotnet add src/Refhub.Infrastructure/Refhub.Infrastructure.csproj reference src/Refhub.Domain/Refhub.Domain.csproj
dotnet add src/Refhub.Infrastructure/Refhub.Infrastructure.csproj reference src/Refhub.Application/Refhub.Application.csproj
# Web references Application and Infrastructure
dotnet add Refhub/Refhub.csproj reference src/Refhub.Application/Refhub.Application.csproj
dotnet add Refhub/Refhub.csproj reference src/Refhub.Infrastructure/Refhub.Infrastructure.csproj
Day 4-5: Package Installation and Folder Creation
- Install required packages in each project
- Create folder structures
- Add placeholder classes with proper namespaces
- Update existing project structure
π Example Files to Create
Refhub.Domain/Common/BaseEntity.cs
namespace Refhub.Domain.Common;
public abstract class BaseEntity
{
public long Id { get; set; }
public DateTime CreatedAt { get; set; }
public DateTime? UpdatedAt { get; set; }
public string? CreatedBy { get; set; }
public string? UpdatedBy { get; set; }
}
Refhub.Application/Common/IRepository.cs
namespace Refhub.Application.Common;
public interface IRepository<T> where T : class
{
Task<T?> GetByIdAsync(long id, CancellationToken cancellationToken = default);
Task<IEnumerable<T>> GetAllAsync(CancellationToken cancellationToken = default);
Task<T> AddAsync(T entity, CancellationToken cancellationToken = default);
Task UpdateAsync(T entity, CancellationToken cancellationToken = default);
Task DeleteAsync(T entity, CancellationToken cancellationToken = default);
}
π― Testing Criteria
π Related Tasks
π Resources
Sprint: 1 | Assignee: @hootanht | Priority: High | Size: Large
π― Sprint 1 - Task 1: Create Clean Architecture Project Structure
Epic: #121
Sprint: 1 (2 weeks)
Estimated Effort: 5 days
π Description
Create the foundational project structure for Clean Architecture migration. This involves setting up separate class library projects for each layer and establishing proper dependency relationships.
ποΈ Architecture Overview
New Project Structure
Dependency Flow (Clean Architecture Rules)
β Acceptance Criteria
1. Project Structure Setup
Refhub.Domainclass library projectRefhub.Applicationclass library projectRefhub.Infrastructureclass library projectRefhubproject toRefhub.Web2. Project References Configuration
Refhub.Domain: No external dependencies (only .NET 9)Refhub.Application: References onlyRefhub.DomainRefhub.Infrastructure: ReferencesRefhub.DomainandRefhub.ApplicationRefhub.Web: ReferencesRefhub.ApplicationandRefhub.Infrastructure3. Basic Folder Structure
4. Package Dependencies
π¦ Required NuGet Packages
Refhub.Domain
Refhub.Application
Refhub.Infrastructure
Refhub.Web (Existing packages + new ones)
π§ Implementation Steps
Day 1-2: Project Creation and Structure
Create new class library projects
Update solution file
# Add projects to solution dotnet sln add src/Refhub.Domain/Refhub.Domain.csproj dotnet sln add src/Refhub.Application/Refhub.Application.csproj dotnet sln add src/Refhub.Infrastructure/Refhub.Infrastructure.csproj dotnet sln add tests/Refhub.Domain.Tests/Refhub.Domain.Tests.csproj dotnet sln add tests/Refhub.Application.Tests/Refhub.Application.Tests.csproj dotnet sln add tests/Refhub.Infrastructure.Tests/Refhub.Infrastructure.Tests.csproj dotnet sln add tests/Refhub.Web.Tests/Refhub.Web.Tests.csprojDay 3: Configure Project References
Day 4-5: Package Installation and Folder Creation
π Example Files to Create
Refhub.Domain/Common/BaseEntity.cs
Refhub.Application/Common/IRepository.cs
π― Testing Criteria
π Related Tasks
π Resources
Sprint: 1 | Assignee: @hootanht | Priority: High | Size: Large