12 KiB
AGENTS.md
This file provides guidance to Codex when working with code in this repository.
Development Commands
Building
- Build entire solution:
dotnet build Centron.sln - Build specific project:
dotnet build src/centron/Centron.WPF.UI/Centron.WPF.UI.csproj - Build for Release:
dotnet build Centron.sln -c Release
Testing
- Run all tests:
dotnet test Centron.sln - Run specific test project:
dotnet test tests/backend/Centron.Tests.BL/Centron.Tests.BL.csproj - Run integration tests:
dotnet test tests/Centron.Tests.Integration/Centron.Tests.Integration.csproj - Run end-to-end tests:
dotnet test tests/Centron.Tests.EndToEnd/Centron.Tests.EndToEnd.csproj
Using Centron.Scripts Build System
The project uses a custom build system via Centron.Scripts for complete builds:
cd scripts/Centron.Scripts
dotnet run -- <target>
Available targets:
clean- Clean artifacts and bin/obj directoriessetup-versioning- Set up version informationbuild-web-service- Build the web service componentsbuild-centron-net- Build the WPF client applicationrun-tests- Execute all test suitescreate-installers- Build MSI installers
Publishing
- Publish WPF UI:
dotnet publish src/centron/Centron.WPF.UI/Centron.WPF.UI.csproj -c Release -r win-x64 --self-contained - Publish Web Service:
dotnet publish src/webservice/Centron.Host.WindowsService/Centron.Host.WindowsService.csproj -c Release -r win-x64 --self-contained
Project Architecture
High-Level Structure
This is a .NET 8 enterprise application with a multi-layered architecture:
src/
├── apis/ - External API integrations (FinAPI, GLS, Shipcloud, etc.)
├── backend/ - Core business logic layer
│ ├── Centron.BL/ - Business Logic layer
│ ├── Centron.Common/ - Common utilities and helpers
│ ├── Centron.DAO/ - Data Access Objects (NHibernate)
│ ├── Centron.Entities/ - Domain entities
│ ├── Centron.Gateway/ - External service gateways
│ └── Centron.Interfaces/ - Service interfaces
├── centron/ - WPF client application
│ ├── Centron.WPF.UI/ - Main WPF application
│ └── Centron.WPF.UI.Extension/ - UI extensions
├── shared/ - Shared components and controls
│ ├── Centron.Core/ - Core shared functionality
│ ├── Centron.Controls/ - Custom UI controls
│ └── Centron.Controls.Preview/ - Preview controls
└── webservice/ - Web service components
├── Centron.Host/ - Web service host
├── Centron.Host.Console/ - Console host
├── Centron.Host.WindowsService/ - Windows service host
├── Centron.WebServices.Core/ - Web service core
└── c-entron.misc.ConnectionManager/ - Connection management
Data Access Pattern
The application uses a dual data access pattern supporting both direct database access and web service communication:
ILogic Interface Pattern
All data operations use the ILogic interface accessed through ClassContainer:
var result = await ClassContainer
.Instance
.WithInstance((IAccountContractsLogic logic) => logic.GetAccountContracts(filter))
.ThrowIfError();
Dual Implementation Requirements
Every module MUST implement both:
- ILogic Interface - Defines the contract
- BLLogic Class - Direct database access via NHibernate
- WSLogic Class - Web service access via REST API
Technology Stack
- .NET 8 - Primary framework
- WPF - Desktop UI framework
- NHibernate - ORM for database access
- DevExpress 24.2.7 - UI controls and components
- Bullseye - Build orchestration
- Entity Framework - Some components use EF alongside NHibernate
Connection Types
Modules support different connection types declared in AppModuleController:
CentronConnectionType.CentronWebServices- Uses WSLogic implementationCentronConnectionType.SqlServer- Uses BLLogic implementation
Development Guidelines
Language Requirements
- All user-facing content must be in German (primary market)
- Support for English through localization files
- Use German resource files (LocalizedStrings.resx) and English (LocalizedStrings.en.resx)
File Encoding
- All C# source files (*.cs) must use UTF-8 with BOM
- All XAML files (*.xaml) must use UTF-8 with BOM
Naming Conventions
- ILogic interfaces:
I{Module}Logic - BL implementations:
BL{Module}Logic - WS implementations:
WS{Module}Logic - All methods return
Result<T>orTask<Result<T>>
Code Signing (Optional)
Set environment variables for code signing:
CENTRON_BUILD_CODE_SIGNING_CERTIFICATE- Path to certificateCENTRON_BUILD_CODE_SIGNING_CERTIFICATE_PASSWORD- Certificate password
Database
- Uses NHibernate ORM with SQL Server
- Configuration files generated during build process
- Test databases required for end-to-end testing
Development Processes
Database Schema Changes
Creating Database Scripts
- Reserve script number in Teams
c-entron Entwicklergroup → Files →Datenbankupdate 2 1.xlsx - Create script class at
src/backend/Centron.BL/Administration/Scripts/ScriptMethods/Scripts/ScriptMethod{number}.cs - Implement BaseScriptMethod with
ApplicationVersionandGetSqlQueries()method - Use ScriptHelpers when possible (preferred over raw SQL):
ScriptHelpers.AddColumnIfNotExists()ScriptHelpers.AddTableIfNotExists()ScriptHelpers.AddRightIfNotExists()ScriptHelpers.AddIndexIfNotExists()ScriptHelpers.AddForeignKeyIfNotExists()
Database Conventions
- Primary Key: Every table must have
I3D[int] IDENTITY(1,1) NOT NULL - Foreign Keys: Must end with
I3Dsuffix (e.g.,AccountI3D) - Standard Columns: Include
CreatedByI3D,CreatedDate,ChangedByI3D,ChangedDate,IsDeleted,DeletedByI3D,DeletedDate - Data Types: Use
nvarcharovervarchar,datetime2(2)for timestamps,bitfor booleans - Naming: New tables/columns use English names (historical German names remain unchanged)
Settings Management
Application Settings
- Legacy settings: Stored in
Stammdattable (read-only, no new additions) - New settings: Use
ApplicationSettingstable exclusively - Setting IDs: Get next available ID from comment in
src/backend/Centron.Interfaces/Administration/Settings/ApplicationSettingID.cs - Descriptions: Add to
ApplicationSettingDefinitions.cs
Adding New Settings
- Check next available ID in
ApplicationSettingID.cs - Add enum value with new ID
- Update "Next Centron Settings ID" comment
- Add description in
ApplicationSettingDefinitions.cs - Create group setting classes for accessing settings
- Use
AppSettingsBL.GetSettings()andGetSettingsForUpdate()
User Rights Management
Adding New Rights
- Open
UserRightsConst.csto get next I3D - Create script using
ScriptHelpers.AddRightIfNotExists():yield return ScriptHelpers.AddRightIfNotExists( UserRightsConst.Sales.Customer.Helpdesk.SHOW_HOURLYSURCHARGERATES, UserRightsConst.Sales.Customer.Helpdesk.ID, "German display name", "German description"); - Add constant to
UserRightsConst.cs
Web Service Development
Creating Web Service Methods (Full Stack)
- BL Layer: Create method in
{Entity}BL.csreturningResult<T> - WebServiceBL: Create
{Entity}WebServiceBL.cswith DTO↔Entity conversion - RestService: Add method to
CentronRestService.csacceptingRequest<T>and returningResponse<T> - Interface: Add method signature to
ICentronRestService.cswith attributes:[OperationContract] [WebInvoke(Method = "POST", UriTemplate = "MethodName")] [Authenticate] - Logic Interfaces: Create
I{Entity}Logic,BL{Entity}Logic,WS{Entity}Logic
Request Classes
- Place in
Centron.WebServices.Core/RestRequests/ - Decorate with
[DataContract]and[DataMember]attributes - Use for complex parameters instead of multiple individual parameters
UI Development
Creating WPF Modules
- AppModuleController: Implement
ICentronAppModuleController - View: Create
UserControlinheriting fromBaseModule - ViewModel: Inherit from
BindableBase - Ribbon: Implement
IRibbonControlModuleinterface variations - Registration: Add to
ModuleRegistration.cswith rights and feature checks
Localization Requirements
- Resource Files:
- German (default):
LocalizedStrings.resx - English:
LocalizedStrings.en.resx
- German (default):
- XAML Usage:
{x:Static properties:LocalizedStrings.KeyName} - Code Usage: Direct access via
LocalizedStrings.KeyName - Key Format:
{ClassName}_{MethodName}_{Description} - Tool: Use ResXManager Visual Studio extension
Accessing Data in Client Code
Single Use
var result = await ClassContainer.Instance
.WithInstance((IEntityLogic logic) => logic.GetEntity(id))
.ThrowIfError();
Multiple Uses (with proper disposal)
public class ViewModel : IDisposable
{
private readonly IEntityLogic _logic;
public ViewModel()
{
_logic = ClassContainer.Instance.GetInstance<IEntityLogic>();
}
public void Dispose()
{
ClassContainer.Instance.ReleaseInstance(_logic);
}
}
Documentation
Creating Documentation
When adding new documentation to the project:
-
Choose the right location within the existing
docs/structure:docs/getting-started/- Beginner guides and introductory materialdocs/guides/development/- Development task guidesdocs/guides/database/- Database-related guidesdocs/guides/ui/- UI development guidesdocs/guides/services/- Web services guidesdocs/reference/architecture/- Architecture specificationsdocs/reference/database/- Database reference documentationdocs/reference/receipts/- Receipts system documentationdocs/reference/security/- Security documentationdocs/operations/- Operational procedures
-
Name the file appropriately using kebab-case (e.g.,
actionprice-system.md) -
Create the file with UTF-8 with BOM encoding, using proper Markdown format
-
Update navigation in
docs/README.md:- Add a new entry with a link to your documentation file
- Follow the existing pattern and place in appropriate section
-
Update the Solution File (
Centron.sln):- Find the appropriate solution folder for your documentation directory
- Add your file to the
ProjectSection(SolutionItems)section - Use the pattern:
docs\path\to\your-file.md = docs\path\to\your-file.md
Documentation Standards
- Use UTF-8 with BOM encoding for all documentation files
- Start with a
#heading that clearly describes the content - Use proper Markdown formatting for headings, lists, code blocks, etc.
- Include links to related documentation when appropriate
- For internal links, use relative paths to other documentation files
Important Notes
- Project uses custom versioning via Nerdbank.GitVersioning
- Build artifacts placed in
/artifactsdirectory - Integration with Azure DevOps for CI/CD
- Automatic ticket integration with c-entron ticket system
- Supports both standalone and web service deployment modes
- Always test database scripts before committing
- Use German for all user-facing text with English translations
- Follow dual implementation pattern (BL + WS) for all data access