π 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
- π― Overview & Purpose
- βοΈ Dependencies & Technologies
- π§© Data Models
3.1. DirectorLeaseInfo Class - π Properties Explained
- π οΈ Key Functional Areas
- π Helper Methods / Utilities
- β Error Handling & Return Types
- π API Endpoints Overview
- π ThirdβParty Integrations
- π» Sample Code Blocks
- π UML Class Diagram
- π οΈ Usage Examples
- π 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.DirectorLeaseInfotable 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
MonthlyTotalCostat 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,DirectorLeaseInfodoes 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 exposingDirectorLeaseInfoshould 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
DbContextconfiguration, 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
- Adding a new lease info in a service layer:
public async Task AddLeaseInfoAsync(DirectorLeaseInfo info) { _context.DirectorLeaseInfos.Add(info); await _context.SaveChangesAsync(); } - 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(); - 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. π