πŸ“± MobileDevice.cs Documentation


πŸ“‘ Table of Contents

  1. Overview & Purpose
  2. Dependencies & Technologies
  3. Class Definition & Structure
  4. UML Class Diagram
  5. Sample Usage & Code Snippets
  6. Integration & Mapping
  7. 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.MobileDevice is 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

πŸš€ Constructor

public MobileDevice()
{
    Category = AssetCategory.MobileDevice;
}
  • Purpose:
    • Automatically sets the inherited Category property to MobileDevice
    • Ensures consistency across all mobile device instances

πŸ“‹ 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 MobileDevice class 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();
      
  • 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