π± MobileDevice.cs Documentation
π Table of Contents
- Overview & Purpose
- Dependencies & Technologies
- Class Definition & Structure
- UML Class Diagram
- Sample Usage & Code Snippets
- Integration & Mapping
- Conclusion
π§ Overview & Purpose
MobileDevice.cs is part of the IrbyImaging.DomainClasses assembly and defines the MobileDevice domain model. This class represents a mobile asset in the Irby Imaging system, encapsulating all relevant information such as device type, carrier details, phone number, IMEI/SIM identifiers, and telematics integration flag.
Intended Use:
- Model mobile device records in the back-end domain layer
- Serve as aΒ data carrier between business logic and persistence (e.g., Entity Framework)
- Enable strong typing for AssetCategory
MobileDevice
π§ Dependencies & Technologies
| Technology / Namespace | Purpose |
|---|---|
System (implicit) |
Core .NET types |
IrbyImaging.DomainClasses |
Base domain models and enums |
IrbyImaging.Utility |
Utility classes, including AssetCategory enum |
Note:
- The class inherits from
Asset, which is assumed to define common asset properties (e.g.,Id,Name,Category,AcquisitionDate, etc.).AssetCategory.MobileDeviceis set in the constructor to categorize this asset type automatically.
π Class Definition & Structure
using IrbyImaging.Utility;
namespace IrbyImaging.DomainClasses
{
/// <summary>
/// Represents a mobile device asset within the Irby Imaging domain.
/// </summary>
public class MobileDevice : Asset
{
public MobileDevice()
{
Category = AssetCategory.MobileDevice;
}
public DeviceType Type { get; set; }
public Carrier Carrier { get; set; }
public string PhoneNumber { get; set; }
public string Imei { get; set; }
public string Sim { get; set; }
public bool IsTelogis { get; set; }
}
}
π Inheritance
- Base Class:
Asset- Contains shared asset properties (e.g.,
Id,Name,Category,PurchaseDate, etc.) - Defines core behavior for all assets in the system
- Contains shared asset properties (e.g.,
π Constructor
public MobileDevice()
{
Category = AssetCategory.MobileDevice;
}
- Purpose:
- Automatically sets the inherited
Categoryproperty toMobileDevice - Ensures consistency across all mobile device instances
- Automatically sets the inherited
π Properties
| Property | Type | Description |
|---|---|---|
Type |
DeviceType |
The kind of mobile device (e.g., SmartPhone, Tablet). Defined in the DeviceType enum. |
Carrier |
Carrier |
The network carrier (e.g., Verizon, AT&T). Defined in the Carrier enum. |
PhoneNumber |
string |
The phone number assigned to this device. |
Imei |
string |
The International Mobile Equipment Identity β unique identifier for GSM devices. |
Sim |
string |
The SIM card serial number (ICCID). |
IsTelogis |
bool |
Indicates if the device is integrated with the Telogis telematics platform. |
π UML Class Diagram
+----------------------------+
| <<Asset>> |
| + Id: Guid |
| + Name: string |
| + Category: AssetCategory |
| + ... |
+-------------^--------------+
|
|
+-----------------------------+
| MobileDevice |
+-----------------------------+
| - Type: DeviceType |
| - Carrier: Carrier |
| - PhoneNumber: string |
| - Imei: string |
| - Sim: string |
| - IsTelogis: bool |
+-----------------------------+
| + MobileDevice() |
+-----------------------------+
π» Sample Usage & Code Snippets
1. Creating a New MobileDevice
var phone = new MobileDevice
{
Name = "iPhone 13 Pro",
Type = DeviceType.SmartPhone,
Carrier = Carrier.Verizon,
PhoneNumber = "+1-555-123-4567",
Imei = "353490110123456",
Sim = "8921440512345678901",
IsTelogis = false,
PurchaseDate = DateTime.UtcNow
};
2. Saving to a DbContext (Entity Framework example)
using (var context = new IrbyImagingContext())
{
context.Assets.Add(phone);
context.SaveChanges();
}
π Integration & Mapping
- Entity Framework:
- The
MobileDeviceclass can be included in a DbSet:public DbSet<MobileDevice> MobileDevices { get; set; } - Configure property mappings (if needed) via Fluent API:
modelBuilder.Entity<MobileDevice>() .Property(md => md.Imei) .HasMaxLength(50) .IsRequired();
- The
- Serialization:
- Easily serialized to/from JSON or XML for API payloads or logging.
π Conclusion
MobileDevice.cs is a concise, strongly-typed domain class used to model mobile assets within the Irby Imaging ecosystem. By inheriting from Asset and providing specialized properties (device type, carrier, IMEI, SIM, telematics flag), it ensures consistency and reusability across business logic and data persistence layers.
With clear property definitions and constructor logic, developers can quickly instantiate, persist, and manipulate mobile device records, benefiting from compile-time safety and unified asset handling. π
End of documentation for MobileDevice.cs