1025 lines
38 KiB
Markdown
1025 lines
38 KiB
Markdown
# System Architecture Specification
|
|
## Centron Enterprise Application - Detailed Architecture
|
|
|
|
### Document Information
|
|
- **Document ID**: SyRS-ARCH-CENTRON-2024-001
|
|
- **Version**: 1.0
|
|
- **Date**: September 30, 2024
|
|
- **Related Documents**: SyRS_Complete.md, SyRS_Summary.md, SyRS_Interfaces.md
|
|
- **Project**: UseCaseAnalyse (Centron Enterprise Application)
|
|
|
|
---
|
|
|
|
## 1. Architecture Overview
|
|
|
|
### 1.1 System Context Diagram
|
|
|
|
```mermaid
|
|
graph TB
|
|
subgraph "CENTRON ENTERPRISE SYSTEM"
|
|
subgraph "Client Tier"
|
|
WPF["WPF CLIENT<br/>APPLICATION<br/>• Desktop UI<br/>• MVVM Pattern<br/>• DevExpress Controls"]
|
|
end
|
|
|
|
subgraph "Service Tier"
|
|
WebService["WEB SERVICE<br/>LAYER<br/>• REST APIs<br/>• Service Hosting<br/>• Authentication"]
|
|
end
|
|
|
|
subgraph "Business Tier"
|
|
BL["BUSINESS LOGIC LAYER<br/>• Dual Implementation (BL/WS)<br/>• ILogic Interface Pattern<br/>• Transaction Management<br/>• Business Rules"]
|
|
end
|
|
|
|
subgraph "Data Tier"
|
|
DAL["DATA ACCESS LAYER<br/>• NHibernate ORM<br/>• SQL Server<br/>• Entity Management<br/>• Query Optimization"]
|
|
end
|
|
|
|
subgraph "External Systems"
|
|
FinAPI["FinAPI<br/>(Banking)"]
|
|
GLS["GLS<br/>(Shipping)"]
|
|
Shipcloud["Shipcloud<br/>(Logistics)"]
|
|
ITscope["ITscope<br/>(Product Data)"]
|
|
Icecat["Icecat<br/>(Catalogs)"]
|
|
Egis["Egis<br/>(E-Commerce)"]
|
|
EbInterface["EbInterface<br/>(Business Docs)"]
|
|
CopDataAccess["CopDataAccess<br/>(Data Sync)"]
|
|
end
|
|
end
|
|
|
|
%% Internal Connections
|
|
WPF <--> BL
|
|
WebService <--> BL
|
|
BL --> DAL
|
|
|
|
%% External API Connections
|
|
BL <--> FinAPI
|
|
BL <--> GLS
|
|
BL <--> Shipcloud
|
|
BL <--> ITscope
|
|
BL <--> Icecat
|
|
BL <--> Egis
|
|
BL <--> EbInterface
|
|
BL <--> CopDataAccess
|
|
|
|
%% Styling
|
|
classDef client fill:#e3f2fd
|
|
classDef service fill:#f3e5f5
|
|
classDef business fill:#e8f5e8
|
|
classDef data fill:#fff3e0
|
|
classDef external fill:#fce4ec
|
|
|
|
class WPF client
|
|
class WebService service
|
|
class BL business
|
|
class DAL data
|
|
class FinAPI,GLS,Shipcloud,ITscope,Icecat,Egis,EbInterface,CopDataAccess external
|
|
```
|
|
|
|
### 1.2 Architectural Principles
|
|
|
|
#### **1.2.1 Multi-Layer Architecture**
|
|
- **Separation of Concerns**: Clear layer boundaries with defined responsibilities
|
|
- **Dependency Inversion**: Higher-level modules don't depend on lower-level modules
|
|
- **Interface Segregation**: Clients only depend on interfaces they use
|
|
- **Single Responsibility**: Each component has one reason to change
|
|
|
|
#### **1.2.2 Dual Access Pattern**
|
|
- **ILogic Interface Abstraction**: Single interface supporting multiple backends
|
|
- **BL Implementation**: Direct database access for performance-critical scenarios
|
|
- **WS Implementation**: Web service access for distributed deployments
|
|
- **Runtime Selection**: Dynamic backend selection based on connection type
|
|
|
|
#### **1.2.3 Plugin Architecture**
|
|
- **Modular Design**: Core system with pluggable modules
|
|
- **Dynamic Loading**: Runtime module discovery and initialization
|
|
- **Extensibility**: New functionality added without core system changes
|
|
- **Isolation**: Module failures don't affect core system stability
|
|
|
|
---
|
|
|
|
## 2. Detailed Architecture Components
|
|
|
|
### 2.1 Client Architecture (src/centron/)
|
|
|
|
#### **2.1.1 Primary Components**
|
|
|
|
**Centron.WPF.UI** - Main WPF Application
|
|
```
|
|
src/centron/Centron.WPF.UI/
|
|
├── App.xaml.cs # Application entry point and initialization
|
|
├── FrontWindow.xaml # Main application window
|
|
├── Services/
|
|
│ ├── Container/
|
|
│ │ ├── ClassContainer.cs # Castle Windsor DI container
|
|
│ │ ├── Installers/ # DI component installers
|
|
│ │ └── Interceptors/ # AOP interceptors
|
|
│ └── Logics/ # ILogic implementations
|
|
│ ├── BusinessLogics/ # BL implementations
|
|
│ └── WebServices/ # WS implementations
|
|
├── Modules/ # Application modules
|
|
├── Views/ # XAML views and user controls
|
|
├── ViewModels/ # MVVM view models
|
|
├── Managers/ # Application managers
|
|
├── Classes/ # Helper classes and utilities
|
|
└── Resources/ # Application resources and localization
|
|
```
|
|
|
|
**Centron.WPF.UI.Extension** - UI Extensions and Helpers
|
|
```
|
|
src/centron/Centron.WPF.UI.Extension/
|
|
├── Core/ # Core extension functionality
|
|
├── Controls/ # Custom WPF controls
|
|
├── Behaviors/ # WPF behaviors
|
|
├── Commands/ # MVVM command implementations
|
|
├── Converters/ # Value converters
|
|
├── Helpers/ # UI helper classes
|
|
├── Messages/ # Message passing infrastructure
|
|
└── Mvvm/ # MVVM base classes
|
|
```
|
|
|
|
#### **2.1.2 Key Architectural Patterns**
|
|
|
|
**MVVM Pattern Implementation**
|
|
- **Views**: XAML-based user interfaces with minimal code-behind
|
|
- **ViewModels**: Business logic presentation layer with data binding
|
|
- **Models**: Domain entities and data transfer objects
|
|
- **Commands**: ICommand implementations for user actions
|
|
- **Messaging**: Loose coupling through message passing
|
|
|
|
**Dependency Injection with Castle Windsor**
|
|
```csharp
|
|
public class ClassContainer
|
|
{
|
|
private WindsorContainer _rootContainer;
|
|
private WindsorContainer _databaseContainer; // BL implementations
|
|
private WindsorContainer _webServiceContainer; // WS implementations
|
|
|
|
public void SetContext(CentronConnectionType connectionType)
|
|
{
|
|
// Dynamic container selection based on connection type
|
|
_currentContainer = connectionType switch
|
|
{
|
|
CentronConnectionType.SqlServer => _databaseContainer,
|
|
CentronConnectionType.CentronWebServices => _webServiceContainer,
|
|
_ => throw new ArgumentOutOfRangeException()
|
|
};
|
|
}
|
|
}
|
|
```
|
|
|
|
**Module System Architecture**
|
|
```csharp
|
|
public interface ICentronAppModuleController
|
|
{
|
|
string ModuleName { get; }
|
|
UserRight[] RequiredRights { get; }
|
|
bool CanLoad(IServiceProvider services);
|
|
Task<bool> LoadAsync();
|
|
Task<bool> UnloadAsync();
|
|
}
|
|
```
|
|
|
|
### 2.2 Backend Architecture (src/backend/)
|
|
|
|
#### **2.2.1 Component Structure**
|
|
|
|
**Centron.BL** - Business Logic Layer
|
|
```
|
|
src/backend/Centron.BL/
|
|
├── Administration/ # System administration logic
|
|
│ ├── Scripts/ # Database migration scripts
|
|
│ ├── Settings/ # Configuration management
|
|
│ └── Rights/ # User rights management
|
|
├── Sales/ # Sales process logic
|
|
│ ├── Customers/ # Customer management
|
|
│ ├── Receipts/ # Invoice and receipt processing
|
|
│ └── Support/ # Customer support
|
|
├── Finances/ # Financial management
|
|
├── Helpdesk/ # Helpdesk operations
|
|
├── Projects/ # Project management
|
|
├── Warehousing/ # Inventory management
|
|
└── WebServices/ # WebService BL implementations
|
|
```
|
|
|
|
**Centron.DAO** - Data Access Layer
|
|
```
|
|
src/backend/Centron.DAO/
|
|
├── NHibernateConfiguration/ # NHibernate setup and configuration
|
|
├── Mappings/ # FluentNHibernate entity mappings
|
|
├── Repositories/ # Repository pattern implementations
|
|
├── CustomDAOs/ # Specialized data access objects
|
|
├── NamedQueries/ # Pre-defined HQL queries
|
|
└── Classes/ # Base DAO classes and utilities
|
|
```
|
|
|
|
**Centron.Entities** - Domain Entities
|
|
```
|
|
src/backend/Centron.Entities/
|
|
├── Entities/ # Core domain entities
|
|
│ ├── Administration/ # Administrative entities
|
|
│ ├── CustomerArea/ # Customer-related entities
|
|
│ ├── Sales/ # Sales entities
|
|
│ ├── Finances/ # Financial entities
|
|
│ └── Helpdesk/ # Support entities
|
|
└── WebServices/ # DTO entities for web services
|
|
```
|
|
|
|
#### **2.2.2 Data Access Patterns**
|
|
|
|
**Dual Implementation Pattern**
|
|
```csharp
|
|
// Interface definition
|
|
public interface ICustomerLogic
|
|
{
|
|
Task<Result<Customer[]>> GetCustomersAsync(CustomerFilter filter);
|
|
Task<Result<Customer>> SaveCustomerAsync(Customer customer);
|
|
}
|
|
|
|
// BL Implementation (Direct database access)
|
|
public class BLCustomerLogic : BaseBL, ICustomerLogic
|
|
{
|
|
public async Task<Result<Customer[]>> GetCustomersAsync(CustomerFilter filter)
|
|
{
|
|
using var session = NHibernateHelper.GetSession();
|
|
// Direct NHibernate query execution
|
|
return await ExecuteAsync(() =>
|
|
session.QueryOver<Customer>().List().ToArray());
|
|
}
|
|
}
|
|
|
|
// WS Implementation (Web service access)
|
|
public class WSCustomerLogic : ICustomerLogic
|
|
{
|
|
private readonly IRestClient _restClient;
|
|
|
|
public async Task<Result<Customer[]>> GetCustomersAsync(CustomerFilter filter)
|
|
{
|
|
var request = new Request<CustomerFilter> { Data = filter };
|
|
var response = await _restClient.PostAsync<Response<CustomerDTO[]>>(
|
|
"GetCustomers", request);
|
|
// Convert DTOs to entities
|
|
return ConvertCustomerDTOsToCustomers(response.Data);
|
|
}
|
|
}
|
|
```
|
|
|
|
**Repository Pattern with NHibernate**
|
|
```csharp
|
|
public class CustomerRepository : BaseRepository<Customer>
|
|
{
|
|
public async Task<Customer[]> FindByCompanyNameAsync(string companyName)
|
|
{
|
|
using var session = GetSession();
|
|
return await session.QueryOver<Customer>()
|
|
.WhereRestrictionOn(c => c.CompanyName)
|
|
.IsLike($"%{companyName}%")
|
|
.ListAsync();
|
|
}
|
|
}
|
|
```
|
|
|
|
### 2.3 Web Service Architecture (src/webservice/)
|
|
|
|
#### **2.3.1 Hosting Architecture**
|
|
|
|
**Multi-Host Support**
|
|
- **Windows Service Host** (`Centron.Host.WindowsService`): Production deployment
|
|
- **Console Host** (`Centron.Host.Console`): Development and debugging
|
|
- **ASP.NET Core Host** (`Centron.Host`): Web-based deployment
|
|
|
|
**Service Configuration**
|
|
```csharp
|
|
public class Startup
|
|
{
|
|
public void ConfigureServices(IServiceCollection services)
|
|
{
|
|
services.AddSingleton<ICentronRestService, CentronRestService>();
|
|
services.AddScoped<ICustomerWebServiceLogic, CustomerWebServiceLogic>();
|
|
services.AddDbContext<CentronDbContext>(options =>
|
|
options.UseSqlServer(connectionString));
|
|
}
|
|
}
|
|
```
|
|
|
|
#### **2.3.2 REST Service Implementation**
|
|
|
|
**Interface Partitioning**
|
|
```
|
|
ICentronRestService (Partial Interfaces):
|
|
├── ICentronRestService.Administration.cs # User and system administration
|
|
├── ICentronRestService.Finances.cs # Financial operations
|
|
├── ICentronRestService.Helpdesk.cs # Support and ticketing
|
|
├── ICentronRestService.ArticleManagement.cs # Product management
|
|
├── ICentronRestService.CrmProjects.cs # CRM and project management
|
|
└── ICentronRestService.Notifications.cs # Notification services
|
|
```
|
|
|
|
**WebService BL Pattern**
|
|
```csharp
|
|
public class CustomerWebServiceBL : BaseBL
|
|
{
|
|
private readonly CustomerBL _customerBL;
|
|
|
|
public CustomerWebServiceBL()
|
|
{
|
|
_customerBL = new CustomerBL();
|
|
}
|
|
|
|
public async Task<Result<CustomerDTO[]>> GetCustomersAsync(CustomerFilter filter)
|
|
{
|
|
// Call base BL for business logic
|
|
var result = await _customerBL.GetCustomersAsync(filter);
|
|
if (result.HasError) return result.AsError<CustomerDTO[]>();
|
|
|
|
// Convert entities to DTOs (disconnected from NHibernate context)
|
|
var dtos = ObjectMapper.Map<CustomerDTO[]>(result.Data);
|
|
return Result.AsSuccess(dtos);
|
|
}
|
|
}
|
|
```
|
|
|
|
### 2.4 Integration Architecture (src/apis/)
|
|
|
|
#### **2.4.1 External API Clients**
|
|
|
|
**Financial Integration - FinAPI**
|
|
```
|
|
src/apis/Centron.APIs.FinAPI/
|
|
├── IFinApiClient.cs # Client interface
|
|
├── FinApiClient.cs # Implementation
|
|
├── Requests/ # Request DTOs
|
|
├── Responses/ # Response DTOs
|
|
├── Data/ # Data models
|
|
└── RestClient/ # HTTP client wrapper
|
|
```
|
|
|
|
**Shipping Integrations**
|
|
- **GLS** (`Centron.Api.Gls`): German shipping provider
|
|
- **Shipcloud** (`Centron.Api.Shipcloud`): Multi-carrier shipping service
|
|
|
|
**Product Data Integrations**
|
|
- **ITscope** (`Centron.APIs.ITscopeDataAccess`): IT product database
|
|
- **Icecat** (`Centron.APIs.IcecatDataAccess`): Product specifications
|
|
- **Egis** (`Centron.APIs.EgisDataAccess`): Specialized product data
|
|
|
|
#### **2.4.2 Integration Patterns**
|
|
|
|
**Standardized Client Interface**
|
|
```csharp
|
|
public interface IExternalApiClient
|
|
{
|
|
bool IsInitialized { get; }
|
|
bool IsAuthenticated { get; }
|
|
Task<Result> AuthenticateAsync(AuthenticationRequest request);
|
|
Task<Result<T>> GetAsync<T>(string endpoint, object parameters = null);
|
|
Task<Result<T>> PostAsync<T>(string endpoint, object data);
|
|
}
|
|
```
|
|
|
|
**Error Handling and Resilience**
|
|
```csharp
|
|
public class ResilientApiClient : IExternalApiClient
|
|
{
|
|
private readonly IRetryPolicy _retryPolicy;
|
|
private readonly ICircuitBreaker _circuitBreaker;
|
|
|
|
public async Task<Result<T>> PostAsync<T>(string endpoint, object data)
|
|
{
|
|
return await _retryPolicy.ExecuteAsync(async () =>
|
|
{
|
|
return await _circuitBreaker.ExecuteAsync(async () =>
|
|
{
|
|
// Actual API call
|
|
return await ExecuteHttpRequestAsync<T>(endpoint, data);
|
|
});
|
|
});
|
|
}
|
|
}
|
|
```
|
|
|
|
### 2.5 Shared Components Architecture (src/shared/)
|
|
|
|
#### **2.5.1 Core Infrastructure**
|
|
|
|
**Centron.Core** - Fundamental Services
|
|
```
|
|
src/shared/Centron.Core/
|
|
├── Events/ # Event handling infrastructure
|
|
├── Extensions/ # Extension methods
|
|
├── Helpers/ # Utility helpers
|
|
├── Mvvm/ # MVVM base classes
|
|
├── Threading/ # Threading utilities
|
|
├── Utils/ # General utilities
|
|
└── Xml/ # XML processing utilities
|
|
```
|
|
|
|
**Centron.Controls** - Business UI Controls
|
|
```
|
|
src/shared/Centron.Controls/
|
|
├── Common/ # Common UI controls
|
|
├── Controls/ # Specialized business controls
|
|
├── CustomerManagement/ # Customer-specific controls
|
|
├── EmployeeManagement/ # HR-related controls
|
|
├── Reports/ # Reporting controls
|
|
├── TaskManagement/ # Task and project controls
|
|
└── Wizard/ # Wizard-style UI controls
|
|
```
|
|
|
|
---
|
|
|
|
## 3. Deployment Architecture
|
|
|
|
### 3.1 Deployment Models
|
|
|
|
#### **3.1.1 Standalone Deployment**
|
|
```
|
|
┌─────────────────────────────────┐
|
|
│ Client Machine │
|
|
├─────────────────────────────────┤
|
|
│ ┌───────────────────────────┐ │
|
|
│ │ Centron.WPF.UI │ │
|
|
│ │ │ │
|
|
│ │ ClassContainer │ │
|
|
│ │ ├─ DatabaseContainer │ │
|
|
│ │ └─ (BL Implementations) │ │
|
|
│ └───────────────────────────┘ │
|
|
│ │ │
|
|
│ ▼ │
|
|
│ ┌───────────────────────────┐ │
|
|
│ │ SQL Server │ │
|
|
│ │ (Local/Network) │ │
|
|
│ └───────────────────────────┘ │
|
|
└─────────────────────────────────┘
|
|
```
|
|
|
|
#### **3.1.2 Distributed Deployment**
|
|
```
|
|
┌─────────────────────┐ ┌─────────────────────────────────┐
|
|
│ Client Machine │ │ Server Machine │
|
|
├─────────────────────┤ ├─────────────────────────────────┤
|
|
│ ┌─────────────────┐ │ │ ┌─────────────────────────────┐ │
|
|
│ │ Centron.WPF.UI │ │ │ │ Centron Web Service │ │
|
|
│ │ │ │◄──►│ │ │ │
|
|
│ │ ClassContainer │ │ │ │ ┌─────────────────────────┐ │
|
|
│ │ ├─WebService │ │ │ │ │ ICentronRestService │ │
|
|
│ │ │ Container │ │ │ │ └─────────────────────────┘ │
|
|
│ │ └─(WS Impls) │ │ │ │ │ │ │
|
|
│ └─────────────────┘ │ │ │ ▼ │ │
|
|
└─────────────────────┘ │ │ ┌─────────────────────────┐ │
|
|
│ │ │ Business Logic │ │
|
|
│ │ │ Layer │ │
|
|
│ │ └─────────────────────────┘ │
|
|
│ │ │ │ │
|
|
│ │ ▼ │ │
|
|
│ │ ┌─────────────────────────┐ │
|
|
│ │ │ SQL Server │ │
|
|
│ │ └─────────────────────────┘ │
|
|
│ └─────────────────────────────┘ │
|
|
└─────────────────────────────────┘
|
|
```
|
|
|
|
### 3.2 Infrastructure Requirements
|
|
|
|
#### **3.2.1 Hardware Requirements**
|
|
|
|
**Client Workstation**
|
|
- **CPU**: Intel i5/AMD Ryzen 5 or better
|
|
- **RAM**: 8GB minimum, 16GB recommended
|
|
- **Storage**: 10GB available space, SSD recommended
|
|
- **Display**: 1920x1080 minimum resolution
|
|
- **Network**: Gigabit Ethernet for database connectivity
|
|
|
|
**Server Infrastructure**
|
|
- **Web Service Server**: 8-core CPU, 16GB RAM, 100GB SSD
|
|
- **Database Server**: 16-core CPU, 32GB RAM, 1TB SSD, RAID 10
|
|
- **Network**: Gigabit LAN, redundant connections
|
|
- **Backup**: Automated backup storage, offsite replication
|
|
|
|
#### **3.2.2 Software Requirements**
|
|
|
|
**Client Environment**
|
|
- **Operating System**: Windows 10/11 Professional
|
|
- **.NET Runtime**: .NET 8 Desktop Runtime
|
|
- **Database Connectivity**: SQL Server Native Client
|
|
- **DevExpress Runtime**: DevExpress 24.2.7 components
|
|
|
|
**Server Environment**
|
|
- **Operating System**: Windows Server 2019/2022
|
|
- **.NET Runtime**: .NET 8 Hosting Bundle
|
|
- **Database**: SQL Server 2019/2022 Enterprise
|
|
- **IIS**: Internet Information Services (for web service hosting)
|
|
|
|
---
|
|
|
|
## 4. Security Architecture
|
|
|
|
### 4.1 Security Layers
|
|
|
|
#### **4.1.1 Authentication and Authorization**
|
|
|
|
**Multi-Factor Authentication Flow**
|
|
```
|
|
┌─────────────┐ ┌─────────────────┐ ┌─────────────────┐
|
|
│ Client │ │ Auth Service │ │ Active Directory│
|
|
│ Application │ │ │ │ │
|
|
├─────────────┤ ├─────────────────┤ ├─────────────────┤
|
|
│1. Credentials│───►│2. AD Validation │───►│3. User Lookup │
|
|
│ Username │ │ │ │ │
|
|
│ Password │ │4. MFA Challenge │◄───│5. User Found │
|
|
│ Domain │◄───│ │ │ │
|
|
├─────────────┤ ├─────────────────┤ └─────────────────┘
|
|
│6. MFA Token │───►│7. Token Verify │
|
|
│ │ │ │
|
|
│8. JWT Token │◄───│9. Generate JWT │
|
|
│ + Rights │ │ + User Rights │
|
|
└─────────────┘ └─────────────────┘
|
|
```
|
|
|
|
**Rights-Based Authorization**
|
|
```csharp
|
|
public static class UserRightsConst
|
|
{
|
|
public static class Sales
|
|
{
|
|
public static class Customer
|
|
{
|
|
public const int SHOW_CUSTOMERS = 1001;
|
|
public const int EDIT_CUSTOMERS = 1002;
|
|
public const int DELETE_CUSTOMERS = 1003;
|
|
|
|
public static class Helpdesk
|
|
{
|
|
public const int SHOW_TICKETS = 1101;
|
|
public const int EDIT_TICKETS = 1102;
|
|
public const int CLOSE_TICKETS = 1103;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
```
|
|
|
|
#### **4.1.2 Data Protection**
|
|
|
|
**Encryption at Rest**
|
|
- **Database**: SQL Server TDE (Transparent Data Encryption)
|
|
- **Application**: AES-256 for sensitive configuration data
|
|
- **Files**: NTFS EFS for file system encryption
|
|
|
|
**Encryption in Transit**
|
|
- **Database Connections**: TLS 1.3 with certificate validation
|
|
- **Web Services**: HTTPS with SSL/TLS certificates
|
|
- **Internal Communication**: Encrypted channels for all data transfer
|
|
|
|
### 4.2 GDPR/DSGVO Compliance Architecture
|
|
|
|
#### **4.2.1 Data Subject Rights Implementation**
|
|
|
|
**GDPR Module Structure**
|
|
```
|
|
Administration/DSGVO/
|
|
├── DataSubjectRequest.cs # Rights request handling
|
|
├── DataPortability.cs # Data export functionality
|
|
├── RightToErasure.cs # Data deletion management
|
|
├── ConsentManagement.cs # Consent tracking
|
|
└── AuditTrail.cs # Compliance auditing
|
|
```
|
|
|
|
**Data Protection by Design**
|
|
```csharp
|
|
[PersonalData]
|
|
public class Customer
|
|
{
|
|
[PrimaryKey]
|
|
public int I3D { get; set; }
|
|
|
|
[PersonalData(Category = "Contact")]
|
|
public string Email { get; set; }
|
|
|
|
[PersonalData(Category = "Identity")]
|
|
public string Name { get; set; }
|
|
|
|
[AuditTrail]
|
|
public DateTime LastModified { get; set; }
|
|
}
|
|
```
|
|
|
|
---
|
|
|
|
## 5. Performance Architecture
|
|
|
|
### 5.1 Performance Optimization Strategies
|
|
|
|
#### **5.1.1 Database Performance**
|
|
|
|
**Query Optimization**
|
|
- **Lazy Loading**: NHibernate lazy loading for related entities
|
|
- **Query Batching**: Batch multiple queries to reduce round trips
|
|
- **Caching**: Second-level cache for frequently accessed data
|
|
- **Indexing**: Strategic database indexing for performance
|
|
|
|
```csharp
|
|
public class CustomerMapping : ClassMap<Customer>
|
|
{
|
|
public CustomerMapping()
|
|
{
|
|
// Lazy loading configuration
|
|
References(x => x.Address).LazyLoad();
|
|
HasMany(x => x.Orders).LazyLoad().Cascade.SaveUpdate();
|
|
|
|
// Caching configuration
|
|
Cache.ReadWrite().Region("Customers");
|
|
}
|
|
}
|
|
```
|
|
|
|
**Connection Management**
|
|
```csharp
|
|
public class OptimizedConnectionManager
|
|
{
|
|
private readonly IConnectionPool _connectionPool;
|
|
|
|
public async Task<T> ExecuteWithOptimalConnection<T>(Func<IDbConnection, Task<T>> operation)
|
|
{
|
|
using var connection = await _connectionPool.GetConnectionAsync();
|
|
|
|
// Connection-level optimizations
|
|
await connection.ExecuteAsync("SET TRANSACTION ISOLATION LEVEL READ COMMITTED");
|
|
|
|
return await operation(connection);
|
|
}
|
|
}
|
|
```
|
|
|
|
#### **5.1.2 UI Performance**
|
|
|
|
**WPF Optimization Techniques**
|
|
- **Virtualization**: ListView and DataGrid virtualization for large datasets
|
|
- **Data Binding**: Optimized binding with change notification
|
|
- **Rendering**: GPU acceleration and rendering optimization
|
|
- **Memory Management**: Proper disposal and memory cleanup
|
|
|
|
```csharp
|
|
public class VirtualizedDataGrid : DataGrid
|
|
{
|
|
protected override void OnLoaded(RoutedEventArgs e)
|
|
{
|
|
// Enable virtualization
|
|
VirtualizingPanel.SetVirtualizationMode(this, VirtualizationMode.Recycling);
|
|
VirtualizingPanel.SetIsVirtualizing(this, true);
|
|
|
|
// Performance optimizations
|
|
EnableRowVirtualization = true;
|
|
EnableColumnVirtualization = true;
|
|
|
|
base.OnLoaded(e);
|
|
}
|
|
}
|
|
```
|
|
|
|
### 5.2 Scalability Architecture
|
|
|
|
#### **5.2.1 Horizontal Scaling**
|
|
|
|
**Load Balancing Strategy**
|
|
```
|
|
┌─────────────────┐ ┌─────────────────────────────────┐
|
|
│ Load Balancer │ │ Web Service Farm │
|
|
├─────────────────┤ ├─────────────────────────────────┤
|
|
│ │ │ ┌─────────────┐ ┌─────────────┐ │
|
|
│ Nginx/IIS │───►│ │ Service │ │ Service │ │
|
|
│ ARR/HAProxy │ │ │ Instance 1 │ │ Instance 2 │ │
|
|
│ │ │ └─────────────┘ └─────────────┘ │
|
|
└─────────────────┘ │ ┌─────────────┐ ┌─────────────┐ │
|
|
│ │ Service │ │ Service │ │
|
|
│ │ Instance 3 │ │ Instance N │ │
|
|
│ └─────────────┘ └─────────────┘ │
|
|
└─────────────────────────────────┘
|
|
│
|
|
▼
|
|
┌─────────────────────────────────┐
|
|
│ Database Cluster │
|
|
│ ┌─────────────────────────┐ │
|
|
│ │ Primary Server │ │
|
|
│ └─────────────────────────┘ │
|
|
│ ┌─────────────────────────┐ │
|
|
│ │ Secondary Servers │ │
|
|
│ │ (Read Replicas) │ │
|
|
│ └─────────────────────────┘ │
|
|
└─────────────────────────────────┘
|
|
```
|
|
|
|
#### **5.2.2 Vertical Scaling**
|
|
|
|
**Resource Optimization**
|
|
- **CPU Utilization**: Multi-threading and parallel processing
|
|
- **Memory Management**: Efficient memory usage and garbage collection
|
|
- **I/O Optimization**: Async/await patterns for non-blocking operations
|
|
- **Caching Strategy**: Multi-level caching for improved response times
|
|
|
|
---
|
|
|
|
## 6. Integration Architecture Patterns
|
|
|
|
### 6.1 External System Integration
|
|
|
|
#### **6.1.1 API Integration Framework**
|
|
|
|
**Standardized Integration Pattern**
|
|
```csharp
|
|
public abstract class BaseExternalApiClient
|
|
{
|
|
protected readonly IHttpClientFactory _httpClientFactory;
|
|
protected readonly ILogger _logger;
|
|
protected readonly IRetryPolicy _retryPolicy;
|
|
|
|
protected async Task<Result<T>> ExecuteApiCallAsync<T>(
|
|
Func<HttpClient, Task<HttpResponseMessage>> apiCall)
|
|
{
|
|
return await _retryPolicy.ExecuteAsync(async () =>
|
|
{
|
|
using var client = _httpClientFactory.CreateClient();
|
|
var response = await apiCall(client);
|
|
|
|
if (response.IsSuccessStatusCode)
|
|
{
|
|
var content = await response.Content.ReadAsStringAsync();
|
|
var result = JsonSerializer.Deserialize<T>(content);
|
|
return Result.AsSuccess(result);
|
|
}
|
|
|
|
return Result.AsError<T>($"API call failed: {response.StatusCode}");
|
|
});
|
|
}
|
|
}
|
|
```
|
|
|
|
**Integration Monitoring**
|
|
```csharp
|
|
public class IntegrationMonitor
|
|
{
|
|
public async Task<IntegrationHealth> CheckIntegrationHealthAsync()
|
|
{
|
|
var healthChecks = new[]
|
|
{
|
|
CheckFinAPIHealthAsync(),
|
|
CheckGLSHealthAsync(),
|
|
CheckShipcloudHealthAsync(),
|
|
CheckITscopeHealthAsync(),
|
|
CheckIcecatHealthAsync()
|
|
};
|
|
|
|
var results = await Task.WhenAll(healthChecks);
|
|
|
|
return new IntegrationHealth
|
|
{
|
|
OverallStatus = DetermineOverallStatus(results),
|
|
ServiceStatuses = results,
|
|
CheckTimestamp = DateTime.UtcNow
|
|
};
|
|
}
|
|
}
|
|
```
|
|
|
|
### 6.2 Data Synchronization Architecture
|
|
|
|
#### **6.2.1 Synchronization Patterns**
|
|
|
|
**Event-Driven Synchronization**
|
|
```csharp
|
|
public class DataSynchronizationService
|
|
{
|
|
private readonly IEventBus _eventBus;
|
|
|
|
public async Task SynchronizeCustomerDataAsync(int customerId)
|
|
{
|
|
// Publish synchronization event
|
|
await _eventBus.PublishAsync(new CustomerDataSyncRequested
|
|
{
|
|
CustomerId = customerId,
|
|
SyncTimestamp = DateTime.UtcNow,
|
|
RequiredSystems = new[] { "FinAPI", "CRM", "Helpdesk" }
|
|
});
|
|
}
|
|
}
|
|
|
|
public class CustomerDataSyncHandler : IEventHandler<CustomerDataSyncRequested>
|
|
{
|
|
public async Task HandleAsync(CustomerDataSyncRequested @event)
|
|
{
|
|
// Coordinate synchronization across systems
|
|
var syncTasks = @event.RequiredSystems.Select(system =>
|
|
SynchronizeWithSystemAsync(system, @event.CustomerId));
|
|
|
|
await Task.WhenAll(syncTasks);
|
|
}
|
|
}
|
|
```
|
|
|
|
---
|
|
|
|
## 7. Quality Attributes Implementation
|
|
|
|
### 7.1 Maintainability Architecture
|
|
|
|
#### **7.1.1 Code Organization**
|
|
|
|
**Clean Architecture Implementation**
|
|
```
|
|
┌─────────────────────────────────────────────┐
|
|
│ PRESENTATION LAYER │
|
|
│ (WPF Views, ViewModels, Controllers) │
|
|
├─────────────────────────────────────────────┤
|
|
│ APPLICATION LAYER │
|
|
│ (Use Cases, Application Services) │
|
|
├─────────────────────────────────────────────┤
|
|
│ DOMAIN LAYER │
|
|
│ (Entities, Domain Services, Rules) │
|
|
├─────────────────────────────────────────────┤
|
|
│ INFRASTRUCTURE LAYER │
|
|
│ (Data Access, External APIs, Framework) │
|
|
└─────────────────────────────────────────────┘
|
|
```
|
|
|
|
**Dependency Management**
|
|
```csharp
|
|
// Good: Dependency inversion
|
|
public class CustomerService
|
|
{
|
|
private readonly ICustomerRepository _repository;
|
|
private readonly IEmailService _emailService;
|
|
|
|
public CustomerService(ICustomerRepository repository, IEmailService emailService)
|
|
{
|
|
_repository = repository;
|
|
_emailService = emailService;
|
|
}
|
|
}
|
|
|
|
// Configuration
|
|
services.AddScoped<ICustomerRepository, CustomerRepository>();
|
|
services.AddScoped<IEmailService, EmailService>();
|
|
services.AddScoped<CustomerService>();
|
|
```
|
|
|
|
### 7.2 Testability Architecture
|
|
|
|
#### **7.2.1 Testing Framework Integration**
|
|
|
|
**Test Pyramid Implementation**
|
|
```
|
|
┌─────────────────┐
|
|
│ E2E │ ← Few, High-level
|
|
│ Tests │
|
|
└─────────────────┘
|
|
┌─────────────────────────┐
|
|
│ Integration Tests │ ← Some, Mid-level
|
|
└─────────────────────────┘
|
|
┌─────────────────────────────────────────┐
|
|
│ Unit Tests │ ← Many, Low-level
|
|
└─────────────────────────────────────────┘
|
|
```
|
|
|
|
**Test Infrastructure**
|
|
```csharp
|
|
[TestFixture]
|
|
public class CustomerServiceTests
|
|
{
|
|
private Mock<ICustomerRepository> _mockRepository;
|
|
private Mock<IEmailService> _mockEmailService;
|
|
private CustomerService _customerService;
|
|
|
|
[SetUp]
|
|
public void Setup()
|
|
{
|
|
_mockRepository = new Mock<ICustomerRepository>();
|
|
_mockEmailService = new Mock<IEmailService>();
|
|
_customerService = new CustomerService(_mockRepository.Object, _mockEmailService.Object);
|
|
}
|
|
|
|
[Test]
|
|
public async Task SaveCustomer_ValidCustomer_ReturnsSuccess()
|
|
{
|
|
// Arrange
|
|
var customer = new Customer { Name = "Test Customer" };
|
|
_mockRepository.Setup(r => r.SaveAsync(customer))
|
|
.ReturnsAsync(Result.AsSuccess(customer));
|
|
|
|
// Act
|
|
var result = await _customerService.SaveCustomerAsync(customer);
|
|
|
|
// Assert
|
|
Assert.IsTrue(result.IsSuccess);
|
|
_mockRepository.Verify(r => r.SaveAsync(customer), Times.Once);
|
|
}
|
|
}
|
|
```
|
|
|
|
---
|
|
|
|
## 8. Technology Decision Rationale
|
|
|
|
### 8.1 Technology Stack Decisions
|
|
|
|
#### **8.1.1 Core Technology Choices**
|
|
|
|
| Technology | Rationale | Alternatives Considered |
|
|
|------------|-----------|------------------------|
|
|
| **.NET 8** | Latest LTS version, performance improvements, cross-platform support potential | .NET Framework 4.8, .NET 6 |
|
|
| **WPF** | Rich desktop UI, mature technology, existing expertise | WinUI 3, Avalonia UI, Electron |
|
|
| **NHibernate** | Mature ORM, existing codebase, advanced features | Entity Framework Core, Dapper |
|
|
| **DevExpress** | Professional UI controls, existing license, rich feature set | Telerik, Syncfusion, Built-in controls |
|
|
| **Castle Windsor** | Mature DI container, existing usage, advanced features | Microsoft DI, Autofac, Unity |
|
|
| **SQL Server** | Enterprise features, existing infrastructure, German compliance | PostgreSQL, MySQL, Oracle |
|
|
|
|
#### **8.1.2 Architectural Pattern Decisions**
|
|
|
|
**Dual Access Pattern**
|
|
- **Decision**: Implement ILogic interface with BL and WS implementations
|
|
- **Rationale**: Supports both high-performance direct access and distributed deployment
|
|
- **Trade-offs**: Increased complexity vs. deployment flexibility
|
|
|
|
**Plugin Architecture**
|
|
- **Decision**: Module-based plugin system with dynamic loading
|
|
- **Rationale**: Enables system extensibility and customization
|
|
- **Trade-offs**: Complex initialization vs. flexibility
|
|
|
|
**MVVM Pattern**
|
|
- **Decision**: Strict MVVM implementation with data binding
|
|
- **Rationale**: Separation of concerns, testability, maintainability
|
|
- **Trade-offs**: Learning curve vs. code quality
|
|
|
|
---
|
|
|
|
## 9. Future Architecture Considerations
|
|
|
|
### 9.1 Evolution Roadmap
|
|
|
|
#### **9.1.1 Technology Evolution**
|
|
|
|
**Phase 1: Current State** (2024)
|
|
- .NET 8 WPF application with dual access pattern
|
|
- SQL Server with NHibernate ORM
|
|
- DevExpress UI controls
|
|
|
|
**Phase 2: Modernization** (2025-2026)
|
|
- Microservices architecture consideration
|
|
- Cloud deployment options (Azure/AWS)
|
|
- API-first architecture enhancement
|
|
|
|
**Phase 3: Future State** (2027+)
|
|
- Cross-platform client options
|
|
- Event-driven architecture
|
|
- AI/ML integration capabilities
|
|
|
|
### 9.2 Scalability Considerations
|
|
|
|
#### **9.2.1 Growth Planning**
|
|
|
|
**User Scale Growth**
|
|
- **Current**: 500 concurrent users
|
|
- **5-Year Target**: 2,000 concurrent users
|
|
- **Architectural Changes**: Load balancing, database scaling, caching optimization
|
|
|
|
**Data Scale Growth**
|
|
- **Current**: 1TB database capacity
|
|
- **5-Year Target**: 10TB+ with archival strategy
|
|
- **Architectural Changes**: Database partitioning, data archival, cloud storage
|
|
|
|
**Feature Expansion**
|
|
- **Current**: Core business functionality
|
|
- **Future**: AI-powered insights, mobile applications, advanced analytics
|
|
- **Architectural Changes**: Microservices, API gateway, event sourcing
|
|
|
|
---
|
|
|
|
## 10. Conclusion
|
|
|
|
### 10.1 Architecture Summary
|
|
|
|
The Centron Enterprise Application architecture represents a sophisticated, multi-layered system designed for German enterprise markets with unique requirements for both performance and flexibility. The innovative dual access pattern (BL/WS) enables the system to serve both high-performance direct database scenarios and distributed web service deployments from a single codebase.
|
|
|
|
### 10.2 Key Architectural Strengths
|
|
|
|
1. **Flexibility**: Dual access pattern supports multiple deployment scenarios
|
|
2. **Scalability**: Multi-tier architecture with horizontal and vertical scaling capabilities
|
|
3. **Maintainability**: Clean architecture with SOLID principles and dependency injection
|
|
4. **Extensibility**: Plugin-based module system for future enhancements
|
|
5. **Compliance**: Built-in GDPR/DSGVO compliance and German market requirements
|
|
6. **Integration**: Comprehensive external API integration framework
|
|
|
|
### 10.3 Implementation Success Factors
|
|
|
|
- **Architectural Discipline**: Strict adherence to defined patterns and principles
|
|
- **Quality Assurance**: Comprehensive testing at all levels
|
|
- **Performance Monitoring**: Continuous performance optimization and monitoring
|
|
- **Documentation**: Maintained architectural documentation and decision records
|
|
- **Team Expertise**: Ongoing team training and knowledge sharing
|
|
|
|
The architecture provides a solid foundation for current requirements while positioning the system for future growth and technological evolution.
|
|
|
|
---
|
|
|
|
**Document Control**
|
|
- **Review Authority**: System Architecture Review Board
|
|
- **Next Review**: November 30, 2024
|
|
- **Distribution**: Development teams, system architects, technical stakeholders
|
|
- **Related Documents**: SyRS_Complete.md, SyRS_Interfaces.md, SyRS_API_Specification.yaml |