How 0baris/netgym works
Project type and purpose
• This is a multi‑layer .NET gym management system (“NetGym”) implemented as a Visual Studio solution (.sln) containing:
• Core libraries (common abstractions and result types)
• Entities (domain models and DTOs)
• DataAccess (repository interfaces and EF Core implementations over SQL Server)
• Business (service interfaces and managers, DI setup via Autofac)
• Two UIs: a ConsoleUI and a WebAPI
• Its purpose is to handle gym operations (members, trainers, subscriptions, payments, campaigns, logs) via a standard 3‑layer architecture.
File structure
• Top‑level projects:
• Core/Core.csproj → common abstractions (IEntity, IResult, DataResult, utility types)
• Entities/Entities.csproj → concrete EF entities and DTOs
• DataAccess/DataAccess.csproj → DataAccess.Abstract (ICampaignDal, IUserDal, etc.) and DataAccess.Concrete.EntityFramework (Ef…Dal, NetGymContext)
• Business/Business.csproj → Business.Abstract (service interfaces), Business.Concrete (CampaignManager, UserManager…), Constants, AutofacBusinessModule
• ConsoleUI/ConsoleUI.csproj → lightweight console front end
• WebAPI/WebAPI.csproj → ASP.NET Core controllers, Program.cs, appsettings.json, HTTP request examples
• SQL scripts (NetgGymDB.sql, NetgGymDB2.sql) define the underlying database schema.
README
• Currently only shows an image link; no textual architecture description. Use the file tree for details.
a. Main components
• External System: SQL Server (NetGymDB)
• Data Layer: EF Core, NetGymContext, Ef…Dal repositories
• Business Layer: service interfaces (ICampaignService, IUserService…), concrete managers
• Core Layer: common utilities, result wrappers, base repository class
• Presentation Layer:
• WebAPI (ASP.NET Core controllers)
• ConsoleUI
• Dependency Injection: Autofac module
b. Relationships and interactions
• Controllers → call Business services
• ConsoleUI → calls Business services
• Business managers → depend on DataAccess interfaces
• DataAccess concrete classes → use EF Core DbContext → SQL Server
• Core provides base classes and interfaces consumed by DataAccess and Business
• AutofacBusinessModule wires Service ←→ Repository interfaces to concrete types
c. Architectural patterns and design principles
• 3‑tier layered architecture (Presentation → Business → Data)
• Repository pattern (IEntityRepository, I…Dal + Ef…Dal)
• Dependency inversion and DI via Autofac
• DTO mapping between Entities and API output models
• Result wrapper pattern (IResult, IDataResult) for standardized responses
d. Key technologies/frameworks/libraries
• .NET 6+ (C#), ASP.NET Core Web API
• Entity Framework Core
• Autofac for DI
• SQL Server relational database
• Major components and their folders/projects
• Interface‑to‑implementation bindings for both services and repositories
• Data flow from API/Console input to DB and back
• Core utilities shared across layers