📖 Documentation: IrbyImaging.DomainClasses/ODSCustomer.cs
Table of Contents
- 🚀 Overview & Purpose
- 🔑 Key Functional Areas
- ⚙️ Dependencies & Technologies
- 🏷️ Data Model:
ODSCustomerClass - 🧰 Helper Methods / Utilities
- 🐞 Error Handling & Return Types
- 🔌 API Endpoints Overview
- 🔗 Third‑Party Integrations
- 💡 Usage Examples & Code Snippets
- 🎯 Conclusion
🚀 Overview & Purpose
The ODSCustomer class represents a customer entity within the Operational Data Store (ODS) of the Irby Imaging system. It serves as a Domain Data Model to map customer-related records retrieved from, or persisted to, the underlying database.
- Namespace:
IrbyImaging.DomainClasses - File:
ODSCustomer.cs - Responsibility: Provide a strongly-typed, in‑memory representation of customer data for business logic, reporting, and integration layers.
🔑 Key Functional Areas
- Encapsulates all core customer attributes (ID, names, types, timestamps).
- Nullable types (
DateTime?,decimal?) allow for absent/optional fields. - Byte arrays (
byte[]) forCUSTOMER_IDandCOMPANY_IDtypically store GUIDs or binary keys. - Easily extended via Data Annotations for ORM mapping (Entity Framework, Dapper, etc.).
⚙️ Dependencies & Technologies
| Dependency | Purpose |
|---|---|
System |
Base .NET types (e.g., DateTime) |
System.Collections.Generic |
Generic collections (unused here) |
System.ComponentModel.DataAnnotations.Schema |
Attribute-based ORM mapping (imported) |
System.Linq |
LINQ operators (unused by this POCO) |
System.Text |
Text manipulation (unused) |
System.Threading.Tasks |
Async programming (unused) |
Note: Although several namespaces are imported, the current class is a simple POCO without explicit annotations or methods.
🏷️ Data Model: ODSCustomer Class
Below is the core definition of the ODSCustomer class. This Plain Old CLR Object (POCO) defines the schema for customer records.
namespace IrbyImaging.DomainClasses
{
public class ODSCustomer
{
public byte[] CUSTOMER_ID { get; set; }
public byte[] COMPANY_ID { get; set; }
public string ORG_OPU { get; set; }
public string ORG_COMPANY { get; set; }
public string NAME { get; set; }
public string DISPLAY_NAME { get; set; }
public DateTime? LAST_UPDATED { get; set; }
public decimal? CUSTOMER_NUMBER { get; set; }
public string CUSTOMER_TYPE_CODE { get; set; }
public string CUSTOMER_TYPE_DESC { get; set; }
}
}
📋 Property Definitions
| Property Name | Type | Nullable? | Description |
|---|---|---|---|
| CUSTOMER_ID | byte[] |
No | Binary key (e.g., GUID) uniquely identifying the customer. |
| COMPANY_ID | byte[] |
No | Binary key linking the customer to a parent company. |
| ORG_OPU | string |
Yes | Operating Processing Unit code. |
| ORG_COMPANY | string |
Yes | Company code within the organization. |
| NAME | string |
Yes | Official name of the customer. |
| DISPLAY_NAME | string |
Yes | User‑friendly name displayed in UIs. |
| LAST_UPDATED | DateTime? |
Yes | Timestamp of the last record update. |
| CUSTOMER_NUMBER | decimal? |
Yes | Numeric customer identifier (business‑specific). |
| CUSTOMER_TYPE_CODE | string |
Yes | Code representing the customer’s type/category. |
| CUSTOMER_TYPE_DESC | string |
Yes | Human‑readable description of the customer type. |
🖼️ Mermaid UML Diagram
classDiagram
direction LR
class ODSCustomer {
+ byte[] CUSTOMER_ID
+ byte[] COMPANY_ID
+ string ORG_OPU
+ string ORG_COMPANY
+ string NAME
+ string DISPLAY_NAME
+ DateTime? LAST_UPDATED
+ decimal? CUSTOMER_NUMBER
+ string CUSTOMER_TYPE_CODE
+ string CUSTOMER_TYPE_DESC
}
note right of ODSCustomer
Domain Data Model
for Customer Records
end note
🧰 Helper Methods / Utilities
None in this class.
All logic related to transformation, validation, or business rules should be implemented in service or repository layers.
🐞 Error Handling & Return Types
Since ODSCustomer is a data container (POCO), it does not implement error handling or return types. Validation and exception management should occur in:
- Data Access Layer (DAL)
- Business Logic Layer (BLL)
- Presentation Layer (PL)
🔌 API Endpoints Overview
This class is NOT an API controller.
However, it may be exposed by various service endpoints, for example:
GET /api/customers/{id}
POST /api/customers
PUT /api/customers/{id}
Each endpoint would map request/response JSON to/from an
ODSCustomerinstance via a DTO or AutoMapper profile.
🔗 Third‑Party Integrations
- Entity Framework
- Dapper
- AutoMapper
- JSON.NET / System.Text.Json
Integrations are achieved by adding attributes (e.g.,
[Table("ODS_CUSTOMER")],[Key], etc.) or by configuring mapping profiles.
💡 Usage Examples & Code Snippets
1. Instantiating & Populating
var customer = new ODSCustomer
{
CUSTOMER_ID = Guid.NewGuid().ToByteArray(),
COMPANY_ID = new Guid("D2D2D2D2-D2D2-D2D2-D2D2-D2D2D2D2D2D2").ToByteArray(),
ORG_OPU = "OPU123",
ORG_COMPANY = "IRBYIM",
NAME = "Acme Corp",
DISPLAY_NAME = "Acme Corporation",
LAST_UPDATED = DateTime.UtcNow,
CUSTOMER_NUMBER = 1001m,
CUSTOMER_TYPE_CODE = "PRT",
CUSTOMER_TYPE_DESC = "Premium Partner"
};
2. Mapping with Entity Framework
modelBuilder.Entity<ODSCustomer>(entity =>
{
entity.ToTable("ODS_CUSTOMER");
entity.HasKey(e => e.CUSTOMER_ID);
entity.Property(e => e.CUSTOMER_ID).HasColumnName("CUSTOMER_ID");
// ... configure other columns
});
3. Querying with Dapper
using (var conn = new SqlConnection(connString))
{
var sql = "SELECT * FROM ODS_CUSTOMER WHERE CUSTOMER_ID = @Id";
var result = await conn.QueryFirstOrDefaultAsync<ODSCustomer>(
sql, new { Id = customerIdByteArray });
}
🎯 Conclusion
The ODSCustomer class is a fundamental building block in the Irby Imaging domain model, representing customer information within the Operational Data Store. It is:
- A POCO with no business logic
- Extensible via Data Annotations or Fluent API
- Ready to integrate with ORMs, mapping tools, and web APIs
By following the patterns outlined above, you can reliably retrieve, manipulate, and persist customer data across all layers of the application stack. Happy coding! 🥳
Document generated on: 2024‑06‑XX