# ECMJobRunner.Domain ## Project Overview ECMJobRunner.Domain is a domain entity library for the ECM Job Runner system. This project contains entity models that represent the database schema for job runner configuration and execution history. ## Target Frameworks - **.NET Framework 4.8** (`net480`) - **.NET 8.0** (`net8.0`) The project is multi-targeted to support both legacy .NET Framework applications and modern .NET 8 applications. ## Technologies ### Entity Framework - **For .NET Framework 4.8**: Entity Framework 6.5.1 - **For .NET 8.0**: Entity Framework Core 8.0.11 with SQL Server provider ## Project Structure ``` ECMJobRunner.Domain/ ├── Entities/ │ ├── Profile.cs # Job configuration profile entity │ ├── ProfileSqlJob.cs # SQL job configuration entity │ └── ProfileHistory.cs # Job execution history entity ├── ECMJobRunner.Domain.csproj └── AGENTS.md # This file ``` ## Entities ### Profile **Table:** `dbo.TBJR_CFG_PROFILE` Represents a job runner profile configuration. **Key Properties:** - `Id` (PK): Primary key, auto-generated - `Active`: Enable/disable switch - `ProfileName`: Name of the profile - `TypeId`: Profile type (0=ADSync, 1=GraphQL, 2=SQL-Job, 3=SQL and REST-Job) - `Schedule`: Cron format schedule - `Comment`: Optional description **Relationships:** - One-to-Many with `ProfileSqlJob` (SQL jobs) - One-to-Many with `ProfileHistory` (execution history) ### ProfileSqlJob **Table:** `dbo.TBJR_CFG_PROFILE_SQLJOB` Represents individual SQL jobs within a profile. **Key Properties:** - `Id` (PK): Primary key, auto-generated - `ProfileId` (FK): Foreign key to `Profile` - `Active`: Enable/disable switch - `Sequence`: Execution order within the profile - `Name`: Optional job name - `SqlCheckQuery`: SQL query for pre-check - `SqlMainQuery`: Main SQL query - `ApiCommand`: API command to execute **Relationships:** - Many-to-One with `Profile` ### ProfileHistory **Table:** `dbo.TBJR_OUT_PROFILE_HISTORY` Stores execution history and results of job profiles. **Key Properties:** - `Id` (PK): Primary key, auto-generated - `ProfileId` (FK): Foreign key to `Profile` - `ResultId`: Result status (0=OK, 1=ERROR, 2=WARNING) - `ResultText`: Result message/details **Relationships:** - Many-to-One with `Profile` ## Database Schema Source The entities are based on SQL Server tables located at: ``` M:\Datenbank\[DD_ECM]-Database\JobRunner\ ``` The following SQL files define the schema: - `[TBJR_CFG_PROFILE].sql` - Profile configuration table - `[TBJR_CFG_PROFILE_SQLJOB].sql` - SQL job configuration table - `[TBJR_OUT_PROFILE_HISTORY].sql` - Execution history table - `[VWJR_CFG_PROFILE].sql` - Profile view (not implemented as entity) - `[VWJR_CFG_PROFILE_SQLJOB].sql` - SQL job view (not implemented as entity) ## Naming Conventions - **Entity Classes**: Clean Pascal case (e.g., `Profile` instead of `TBJR_CFG_PROFILE`) - **Properties**: Pascal case (e.g., `ProfileName` instead of `PROFILE_NAME`) - **Table Mapping**: Uses `[Table]` attribute to map to actual database table names - **Column Mapping**: Uses `[Column]` attribute to map to actual column names - Entity names are simplified without technical prefixes (Jr/Cfg/Out) ## Attributes Used - `[Table]` - Specifies the database table name and schema - `[Column]` - Specifies the database column name - `[Key]` - Marks the primary key - `[Required]` - Marks non-nullable properties - `[MaxLength]` - Specifies maximum string length - `[ForeignKey]` - Specifies foreign key relationships - `[DatabaseGenerated]` - Specifies identity/auto-generated columns ## Building the Project To build the project: ```bash dotnet build ECMJobRunner.Domain.csproj ``` To build for a specific framework: ```bash dotnet build ECMJobRunner.Domain.csproj -f net8.0 dotnet build ECMJobRunner.Domain.csproj -f net480 ``` ## Development Notes - All entities include audit fields: `AddedWho`, `AddedWhen`, `ChangedWho`, `ChangedWhen` - Navigation properties are marked as `virtual` to support lazy loading - Nullable reference types are enabled for better null-safety - XML documentation is generated for IntelliSense support - Default values are set according to database constraints ## Company Information **Author**: Digital Data GmbH **Copyright**: 2026 **Repository**: http://git.dd:3000/AppStd/ECMJobRunner.git