πŸ“„ DirectorLeaseInfo.cs Documentation

Welcome to the comprehensive documentation for the DirectorLeaseInfo domain class in IrbyImaging.DomainClasses. This guide will walk you through the purpose, structure, usage, and technical details of the class, complete with code snippets, diagrams, and tables. πŸš€


πŸ—‚ Table of Contents

  1. 🎯 Overview & Purpose
  2. βš™οΈ Dependencies & Technologies
  3. 🧩 Data Models
    3.1. DirectorLeaseInfo Class
  4. πŸ”‘ Properties Explained
  5. πŸ› οΈ Key Functional Areas
  6. πŸ›  Helper Methods / Utilities
  7. ❗ Error Handling & Return Types
  8. 🌐 API Endpoints Overview
  9. πŸ”— Third‑Party Integrations
  10. πŸ’» Sample Code Blocks
  11. πŸ“ˆ UML Class Diagram
  12. πŸ› οΈ Usage Examples
  13. 🏁 Conclusion

🎯 Overview & Purpose

The DirectorLeaseInfo class encapsulates lease-related financial data for a Director within the Irby Imaging domain. It provides a strongly‑typed representation of key lease metrics that can be stored/retrieved via Entity Framework Core.

  • Primary Goal: Track monthly costs (rent, taxes, insurance) per director.
  • Schema Mapping: Persists to irby.DirectorLeaseInfo table in the database.

βš™οΈ Dependencies & Technologies

Layer Technology / Package
ORM Microsoft.EntityFrameworkCore
Attributes System.ComponentModel.DataAnnotationsSystem.ComponentModel.DataAnnotations.Schema
Language C# (.NET Standard / .NET Core)

🧩 Data Models

DirectorLeaseInfo Class

using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace IrbyImaging.DomainClasses
{
    [Table("DirectorLeaseInfo", Schema = "irby")]
    public class DirectorLeaseInfo
    {
        [Key]
        public Guid Id { get; set; }

        public string Director { get; set; }

        public int? NumberOfProperties { get; set; }

        public decimal? MonthlyAVTax { get; set; }

        public decimal? MonthlyBaseRent { get; set; }

        public decimal? MonthlyInsurancePayment { get; set; }

        public decimal? MonthlySalesTax { get; set; }

        public decimal? MonthlyTotalCost { get; set; }
    }
}

πŸ”‘ Properties Explained

Property Type Description
Id πŸ”‘ Guid Unique identifier (primary key).
Director 🎯 string Name or identifier for the director.
NumberOfProperties 🏘️ int? Number of properties leased by the director.
MonthlyAVTax 🏷️ decimal? Monthly assessed value tax.
MonthlyBaseRent πŸ’° decimal? Monthly base rent amount.
MonthlyInsurancePayment πŸ›‘οΈ decimal? Monthly insurance payment.
MonthlySalesTax πŸ’Έ decimal? Monthly sales tax.
MonthlyTotalCost πŸ’΅ decimal? Sum of all monthly costs (rent + taxes + insurance).

πŸ’‘ Tip: You can compute MonthlyTotalCost at the application layer as:
MonthlyAVTax + MonthlyBaseRent + MonthlyInsurancePayment + MonthlySalesTax


πŸ› οΈ Key Functional Areas

  • Entity Mapping: Attributes [Table] and [Key] integrate with EF Core to map to the database.
  • Data Integrity: Nullable types (int?, decimal?) allow partial data entry when some costs aren’t available.
  • Domain Representation: Encapsulates all lease-related expenses per director in one model.

πŸ›  Helper Methods / Utilities

⚠️ Not Applicable
This class is a pure data model and does not contain methods or business logic. All manipulations should occur in service/repository layers.


❗ Error Handling & Return Types

⚠️ Not Applicable
As a POCO, DirectorLeaseInfo does not handle exceptions or return custom types. Validation and error handling occur at higher layers (e.g., service or API controllers).


🌐 API Endpoints Overview

⚠️ None Defined Here
Any API endpoints exposing DirectorLeaseInfo should be declared in your Web/API layer (e.g., DirectorLeaseInfoController).


πŸ”— Third‑Party Integrations

  • Entity Framework Core: Leverages EF Core for ORM capabilities.
  • SQL Server / PostgreSQL / Oracle: Depending on your DbContext configuration, the [Table] mapping works across multiple relational DBs.

πŸ’» Sample Code Blocks

1. Registering in DbContext

public class IrbyContext : DbContext
{
    public DbSet<DirectorLeaseInfo> DirectorLeaseInfos { get; set; }

    protected override void OnModelCreating(ModelBuilder modelBuilder)
    {
        // Apply configurations automatically
        modelBuilder.ApplyConfigurationsFromAssembly(typeof(DirectorLeaseInfo).Assembly);
    }
}

2. Creating a New Record

var leaseInfo = new DirectorLeaseInfo
{
    Id                      = Guid.NewGuid(),
    Director                = "Jane Doe",
    NumberOfProperties      = 5,
    MonthlyAVTax            = 1250.00m,
    MonthlyBaseRent         = 5000.00m,
    MonthlyInsurancePayment = 750.00m,
    MonthlySalesTax         = 300.00m,
    MonthlyTotalCost        = 7300.00m
};

using var context = new IrbyContext();
context.DirectorLeaseInfos.Add(leaseInfo);
await context.SaveChangesAsync();

3. Querying Records

using var context = new IrbyContext();
var results = await context.DirectorLeaseInfos
    .Where(d => d.Director.StartsWith("J"))
    .ToListAsync();

πŸ“ˆ UML Class Diagram

classDiagram
    class DirectorLeaseInfo {
        + Guid Id
        + string Director
        + int? NumberOfProperties
        + decimal? MonthlyAVTax
        + decimal? MonthlyBaseRent
        + decimal? MonthlyInsurancePayment
        + decimal? MonthlySalesTax
        + decimal? MonthlyTotalCost
    }

πŸ› οΈ Usage Examples

  1. Adding a new lease info in a service layer:
    public async Task AddLeaseInfoAsync(DirectorLeaseInfo info)
    {
        _context.DirectorLeaseInfos.Add(info);
        await _context.SaveChangesAsync();
    }
    
  2. Updating total cost after recalculation:
    info.MonthlyTotalCost = 
        (info.MonthlyAVTax ?? 0) +
        (info.MonthlyBaseRent ?? 0) +
        (info.MonthlyInsurancePayment ?? 0) +
        (info.MonthlySalesTax ?? 0);
    
    _context.Update(info);
    await _context.SaveChangesAsync();
    
  3. Deleting rental info:
    _context.DirectorLeaseInfos.Remove(info);
    await _context.SaveChangesAsync();
    

🏁 Conclusion

The DirectorLeaseInfo class is a simple, clean, and EF Core‑ready data model designed to capture all monthly lease costs associated with a director.
By adhering to standard data annotations and nullable types, it provides flexibility while ensuring strong typing and easy integration into your data access layer. πŸŽ‰


Thank you for reviewing the documentation! If you have any questions or need further examples, feel free to reach out. 😊