How liukuo362573/yishaadmin works
Project Type and Purpose
• YiShaAdmin is a full-stack .NET Core web management system. It provides both a browser-based UI (YiSha.Admin.Web) and a RESTful API (YiSha.Admin.WebApi) backed by layered services, data access, and a scheduler for background jobs. It targets CMS/CRM/ERP/OA scenarios.
High-Level Architecture
• Layered, modular design:
• Presentation Layer
– YiSha.Admin.Web (MVC Razor UI)
– YiSha.Admin.WebApi (REST API)
• Service/Business Layer
– YiSha.Service (Service classes implementing business logic)
– YiSha.Business (BLL classes, AutoJob scheduling)
• Data Layer
– YiSha.Data.EF (Entity Framework DbContexts, database provider implementations)
– YiSha.Data.Repository (Repository pattern)
– YiSha.Data (low-level helper & extensions, multi-DB support)
• Domain Model
– YiSha.Entity (entities, enums, DTO models)
• Utilities
– YiSha.Util (ID generator, code generator, helpers, caching)
• Infrastructure
– Redis cache (YiSha.Cache)
– Scheduler (YiSha.Business.AutoJob)
– Nginx config, publish scripts
Main Components & Responsibilities
• Browser UI (Razor pages + JS assets)
• API endpoints (Controllers for CRUD operations, file uploads, auth)
• Controller layer invokes Services (e.g., UserService, MenuService)
• Services call BLL to enforce business rules and to orchestrate data operations
• BLL uses RepositoryFactory to obtain repositories for CRUD
• EF DbContexts (MySqlDbContext, SqlServerDbContext) manage ORM to underlying SQL databases
• Scheduler uses IJobTask implementations (e.g., DatabasesBackupJob) to run periodic tasks
• Utilities provide cross-cutting functions: code generation, Snowflake ID, Excel/JSON helpers, validation, caching
Component Interactions & Data Flow
• User → Web UI Controller → Service → BLL → Repository → EF DbContext → Database
• Third-party or mobile client → API Controller → Service/BLL → Data Layer → Database
• Scheduler triggers AutoJobBLL → JobCenter → JobExecute → performs tasks via Data Layer
• Utilities (e.g., RedisCache) are injected at Service/BLL layer for caching; Log filters capture API/operation/login logs
Architectural Patterns & Principles
• Separation of Concerns: distinct layers for presentation, business, data access
• Dependency Injection: controllers/services/bll/repositories registered in Startup.cs
• Repository Pattern: data access abstracted behind IRepository
• Unit of Work implied by EF DbContext
• Modularization: domain organized by feature (OrganizationManage, SystemManage, ToolManage)
• Background Scheduler using custom JobScheduler
Technologies & Frameworks
• .NET Core 6.0+ (ASP.NET Core MVC, ASP.NET Core Web API)
• Entity Framework Core with multi-database support (MySQL, SQL Server, Oracle)
• Razor + jQuery + Bootstrap + various JS libraries for UI
• Redis (YiSha.Cache)
• NLog for logging
• Shell/BAT scripts for CI/CD publishing
• Nginx as reverse proxy
Final Advice
• Modules from the file tree, grouping by layer and feature set
• Technology choices (EF Core, Redis, NLog, Quartz-style scheduler)