This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
This is a .NET 8 MES (Manufacturing Execution System) solution built with ASP.NET Core Web API. The system uses a custom API framework with modular architecture, organizing business functionality into domain-separated projects.
# Build entire solution
dotnet build GsMesSolution.sln
# Run main API (starts on http://localhost:5263 by default)
dotnet run --project Gs.HostIIS
# Build specific module
dotnet build Gs.BaseInfo/Gs.BaseInfo.csproj
http://localhost:5263 (Project profile) or http://localhost:37005 (IIS Express)http://localhost:5263/swaggerThe solution uses a custom framework in Gs.Toolbox that replaces standard ASP.NET Core conventions:
IRomteService interface (not by inheriting ControllerBase)CustomControllerFeatureProvider scans assemblies and the Services folder for classes implementing IRomteService[ApiController] or [Route] attributesServices/ folders act as controllers/{ControllerName}/{ActionName} by CustomApplicationModelConvention[RequestMethod(RequestMethods.POST)] attribute (not standard [HttpPost])ITransient: Transient lifetime (new instance per request)IScope: Scoped lifetime (one instance per request)ISingleton: Singleton lifetime (one instance for application)[Expose(typeof(IYourInterface))] attribute to specify service interface explicitlybuilder.AddCustomInject()[ApiGroup(ApiGroupNames.BaseInfo)] attribute on controller classesApiGroupNames enum (BaseInfo, QC, PerMission, WOM, ErpMes, etc.)Repository<T> in Gs.Toolbox/Repository.csappsettings.json → ConnectionStrings keySqlSugarScope Db instance provides database contextRepository<TEntity> for data accessUseTransaction() methodPageQuery (input) and PageList<T> (output)PageQuery fields: currentPage, everyPageSize, sortName, sortOrder, keyWord, keyWhere, keyTypeCommonPage() methods provide built-in pagination logicAll API responses use ReturnDto<T> wrapper:csharp { "rtnCode": 1, // ReturnCode enum: Success=1, Default=-100, Unauthorized=-101, Exception=-102 "rtnData": {...}, // Generic data payload "rtnMsg": "..." // Optional message }
CustomContractResolverUSER_NAME → userName)"yyyy-MM-dd HH:mm:ss"ApiAuthorizeAttribute filter validates token header"token {guid}" in request header[AllowAnonymous] to bypass authorizationUtilityHelper.GetUserGuidAndOrgGuid(IHttpContextAccessor)ConnectionStrings: SQL Server connection stringTestErpUrl, TestErpUrl2, ProductionErpUrl: ERP integration endpointsServicesPath: Path to compiled DLLs for controller discovery (default: "Services")LogPath: Log file directory (default: "logs")UploadPath: File upload directory (mapped to /upload endpoint)DownPath: File download directory (mapped to /down endpoint)Business modules use custom output paths:
- Compiled DLLs output to Gs.HostIIS/bin/Debug/ (BaseOutputPath configured in .csproj)
- XML documentation files generated automatically for Swagger
- Framework scans Services/ folder at runtime for controller DLLs
xml <ProjectReference Include="..\Gs.Entity\Gs.Entity.csproj" /> <ProjectReference Include="..\Gs.Toolbox\Gs.Toolbox.csproj" /> xml <BaseOutputPath>..\Gs.HostIIS\bin</BaseOutputPath> <OutputPath>..\Gs.HostIIS\bin\Debug\</OutputPath> <GenerateDocumentationFile>True</GenerateDocumentationFile> Repository<TEntity> and IRomteService:csharp [ApiGroup(ApiGroupNames.YourGroup)] public class YourManager : Repository<YourEntity>, IRomteService { [RequestMethod(RequestMethods.POST)] public ReturnDto<PageList<YourEntity>> GetListPage(PageQuery query) { ... } } [ApiGroup(ApiGroupNames.BaseInfo)]
public class MesItemsManager : Repository<MesItems>, IRomteService
{
private readonly IHttpContextAccessor _http;
public MesItemsManager(IHttpContextAccessor httpContextAccessor)
{
_http = httpContextAccessor;
}
[RequestMethod(RequestMethods.POST)]
public ReturnDto<PageList<MesItems>> GetListPage(PageQuery query)
{
// Business logic using Db property from Repository<T>
}
}
var affectedRows = UseTransaction(db => {
db.Insertable(entity).ExecuteCommand();
db.Updateable(otherEntity).ExecuteCommand();
return db.Ado.AffectedRows;
});
Services/ folder - no need to manually register