Skip to content

Repository files navigation

FN.FileManagement

A .NET 10 solution demonstrating N-tier architecture with SOLID principles, applied to file upload and management. Built as a reference implementation covering all layers from REST API down to data access.

Architecture

The solution is structured in strict one-way dependency order:

Presentation     FN.WebApi  ·  FN.Web  ·  FN.WinForm
                      |
Application          FN.Application
                      |
Business Logic       FN.Business
                      |
Data Access          FN.DataLayer
                      |
Cross-cutting    FN.Entities  ·  FN.Common  ·  FN.Functions

Each layer depends only on layers below it. FN.Entities, FN.Common, and FN.Functions can be referenced from any layer.

Projects

Project Responsibility
FN.WebApi REST API (ASP.NET Core, Swagger/OpenAPI)
FN.Web Web UI (ASP.NET Core + Angular client app)
FN.WinForm Windows Forms desktop client
FN.Application Use-case services and validators (IUploadService, UploadService, UploadModelValidator)
FN.Business Domain services and business rules (IUploadDataService, UploadDataService)
FN.DataLayer EF Core 10 repositories and DbContext (IUploadRepository, UploadRepository)
FN.Entities DTOs and domain models (UploadModel, UploadedModel)
FN.Common Shared utilities, FluentValidation extensions
FN.Functions File helpers — upload/download handlers, content-type detection, image resizing (ImageSharp)

Technology Stack

  • .NET 10 / ASP.NET Core
  • Entity Framework Core 10 — in-memory database (toggled via appsettings.json)
  • FluentValidation 12 — input validation
  • SixLabors.ImageSharp — image processing
  • Swagger / OpenAPI — API documentation
  • Newtonsoft.Json — JSON serialization

API Endpoints

Uploads — /api/uploads

Method Route Description
GET /api/uploads List all uploads
GET /api/uploads/{id} Get upload by ID
GET /api/uploads/{id}/{fileName} View upload details
GET /api/uploads/download/{id} Download file
POST /api/uploads Upload a new file (multipart/form-data)
DELETE /api/uploads/{id} Delete an upload

Getting Started

Prerequisites: .NET 10 SDK, Visual Studio 2022+ or VS Code.

# Restore dependencies
dotnet restore

# Run the REST API
cd FN.WebApi
dotnet run
# API available at https://localhost:5001

# Run the Web UI
cd FN.Web
dotnet run

# Run the desktop client (Windows only)
cd FN.WinForm
dotnet run

Configuration (appsettings.json)

Key Description
UseInMemoryDatabase true for in-memory DB (default), false for persistent
UploadPath Directory where uploaded files are stored

Layer Dependency Rules

  • Presentation depends on Application
  • Application depends on Business
  • Business depends on DataLayer
  • Entities, Common, Functions are shared — any layer may reference them
  • No upward dependencies

Adding a New Domain

  1. Define DTOs in FN.Entities
  2. Add repository interface in FN.DataLayer/Abstractions
  3. Implement repository in FN.DataLayer/Repositories
  4. Add data service in FN.Business/Services (business rules here)
  5. Add application service in FN.Application/Services (orchestration + validation)
  6. Register all services in FN.WebApi/Configuration/ServiceCollectionExtensions.cs
  7. Add controller in FN.WebApi/Controllers

About

.NET solution demonstrating N-Tier/Clean Architecture with Domain-Driven Design (DDD) principles for file upload and management operations

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages