📝 Documentation: 20230711133845_updateAddIsHRColumn.Designer.cs

Auto-generated by Entity Framework Core to represent the target model snapshot after applying the updateAddIsHRColumn migration.


Table of Contents

  1. Overview & Purpose
  2. Dependencies & Technologies
  3. Key Functional Areas
  4. BuildTargetModel Method
  5. Data Models & Entity Definitions
    5.1. Schema & Table Mapping
    5.2. Highlighted Entities & Columns
  6. Entity Relationships (UML Diagram)
  7. Usage & Migration Workflow
  8. Conclusion

🔍 1. Overview & Purpose

This file is part of the Entity Framework Core migration named 20230711133845_updateAddIsHRColumn. It was auto-generated to capture the complete model shape after applying the migration, including the new IsHR‑related boolean columns across several document‑related tables.

  • Location: IrbyImaging.DbContext/Migrations/20230711133845_updateAddIsHRColumn.Designer.cs
  • Role:
    • Defines the BuildTargetModel(ModelBuilder modelBuilder) method
    • Captures the entire set of entity configurations, relationships, table mappings and new columns
    • Serves as the “snapshot” for EF Core’s internal migration comparison

⚙️ 2. Dependencies & Technologies

Technology / Package Version/Details
Microsoft.EntityFrameworkCore 7.0.7
Microsoft.EntityFrameworkCore.SqlServer Provides UseIdentityColumns()
Microsoft.EntityFrameworkCore.Storage.ValueConversion Value conversions for properties
.NET Targeted runtime for IrbyContext

Note: This is an EF Core designer file — you do not edit it manually. Any change should be made via the corresponding migration or the DbContext/entity configuration.


🔑 3. Key Functional Areas

  1. Model Annotations
    • Global settings like product version & max identifier length.
  2. Entity Definitions
    • All domain classes mapped to tables (schema "irby" by default).
  3. Property Configurations
    • Column types, nullability, required flags.
  4. Primary Keys & Indexes
    • .HasKey(), .HasIndex(), unique/filtered indexes.
  5. Discriminator & Inheritance
    • Table‐Per‐Hierarchy (TPH) mapping for Asset and its derived types.
  6. Relationships & Navigation
    • Foreign keys with delete behaviors, navigation properties.
  7. New IsHR Columns
    • Added to document tables (Data attribute columns toggling HR filters).

🏗️ 4. BuildTargetModel Method

protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
    #pragma warning disable 612, 618
    modelBuilder
        .HasAnnotation("ProductVersion", "7.0.7")
        .HasAnnotation("Relational:MaxIdentifierLength", 128);

    // Configure SQL Server identity columns
    SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);

    // ... [Entity configurations follow]
    #pragma warning restore 612, 618
}
  • ModelBuilder: the core API for configuring entity types & their mappings.
  • Identity Columns: enables SQL Server identity by default for integer keys.

📦 5. Data Models & Entity Definitions

5.1 Schema & Table Mapping

Entity Class Table Name Schema Notes
IrbyImaging.DomainClasses.Asset Asset irby TPH root; Discriminator = Asset
Computer / DeskPhone / … Asset irby Derived types via .HasDiscriminator
DocumentAttribute DocumentAttribute irby new property: IsHr (bit)
DocumentCategory DocumentCategory irby new property: IsHr (bit)
DocumentType DocumentType irby new property: IsHr (bit)
TempDocumentData TempDocumentData irby new property: IsHr (bit)
DocumentImage DocumentImage irby new property: IsHR (bit)
… plus 50+ other domain tables various irby AssetHistory, Employee, Job, etc.

5.2 Highlighted Entities & Columns

Entity Column Type Nullable Description
DocumentAttribute IsHr bit No Flag to indicate HR‑related attributes
DocumentCategory IsHr bit No Flag to indicate HR‑related categories
DocumentType IsHr bit No Flag to indicate HR‑related document types
TempDocumentData IsHr bit No Flag to mark uploaded temp docs as HR
DocumentImage IsHR bit No Flag for HR images in the permanent store
// Example snippet from DocumentAttribute
modelBuilder.Entity("IrbyImaging.DomainClasses.DocumentAttribute", b =>
{
    b.Property<bool>("IsHr")
     .HasColumnType("bit");
    // … other columns
    b.ToTable("DocumentAttribute", "irby");
});

📈 6. Entity Relationships (UML Diagram)

classDiagram
    Asset <|-- Computer
    Asset <|-- DeskPhone
    Asset <|-- MobileDevice
    AssetModel --> Manufacturer : MakeId
    Asset --> AssetModel : ModelId
    Asset --> FieldOffice : FieldOfficeId
    Asset --> Employee : OwnerId
    Employee --> Job : CurrentJobId
    DocumentAttribute ..> DocumentCategory : none
    DocumentImage --> DocumentType : DocumentTypeId

Legend:
• <|-- inheritance
• --> one‑to‑many FK relations
• ..> conceptual associations


🚀 7. Usage & Migration Workflow

  1. Add Migration
    dotnet ef migrations add updateAddIsHRColumn
    
  2. Inspect Migration Code
    • Check 20230711133845_updateAddIsHRColumn.cs
    • Verify .AddColumn<bool>("IsHr", ...) in Up()
  3. Apply to Database
    dotnet ef database update
    
  4. Verify Schema
    • Use SQL Server Management Studio (SSMS)
    • Confirm new IsHr/IsHR columns in tables

Tip: After applying, never manually edit the Designer file. Changes should flow from your entity classes or new migrations.


✅ 8. Conclusion

The 20230711133845_updateAddIsHRColumn.Designer.cs file is a complete snapshot of your EF Core model after adding HR‑related flags to your document tables. It ensures consistency between your code entities and the database schema, driving smooth migrations and reliable versioning.

💡 Remember: Always manage schema changes via migrations — do not edit Designer files directly.