Show / Hide Table of Contents

Class DataTransferObject<T>

Abstract base class for Data Transfer Objects (DTOs) for managing object I/O operations.

Inheritance
object
DataTransferObject<T>
WMAssetBaseDTO<T>
WMOrganizationDTO
WMUserDTO
DecisionModelDTO
DecisionModelElementDTO
EvaluationDTO
SimulationDTO
SimulationRunDTO
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: Quantellia.WMServer.Base
Assembly: WMServer.dll
Syntax
public abstract class DataTransferObject<T> where T : IDbEntity, new()
Type Parameters
Name Description
T
Remarks

All concrete classes derived from DataTransferObject<T> must implement the following methods:

They may also override the method CreateModel(). By default, CreateModel() creates a new instance of the type, and calls UpdateModel() to populate it.

Constructors

DataTransferObject()

Default constructor that sets the ID to a new GUID.

Declaration
public DataTransferObject()

DataTransferObject(string)

Constructor that initializes the ID.

Declaration
public DataTransferObject(string id)
Parameters
Type Name Description
string id

DataTransferObject(T?)

Initialize object and set the reference to the ModelObject.

Declaration
public DataTransferObject(T? modelObj)
Parameters
Type Name Description
T modelObj

Properties

ID

Declaration
public string ID { get; protected set; }
Property Value
Type Description
string

ModelObject

Reference to the model object represented by this DTO.

Declaration
[NotMapped]
protected T ModelObject { get; set; }
Property Value
Type Description
T

Methods

CreateModel(WMPrincipal, DbContext, object[]?)

Create a new instance of the model type and updates its values based on the contents of this DTO.

Declaration
public virtual Task<T> CreateModel(WMPrincipal principal, DbContext context, object[]? data = null)
Parameters
Type Name Description
WMPrincipal principal
DbContext context
object[] data
Returns
Type Description
Task<T>

FromModel()

Copy the data in this Data Transfer Object into the associated ModelObject

Declaration
public abstract void FromModel()
Remarks

Must be implemented by all concrete classes derived from DataTransferObject<T>

SetID(string)

Set the ID of this object.

Declaration
public void SetID(string id)
Parameters
Type Name Description
string id

UpdateModel(WMPrincipal, DbContext, object[]?)

Copy the data in this Data Transfer Object into the associated model object.

Declaration
public virtual Task<T> UpdateModel(WMPrincipal principal, DbContext context, object[]? data = null)
Parameters
Type Name Description
WMPrincipal principal
DbContext context
object[] data
Returns
Type Description
Task<T>
Remarks

Must be implemented by all concrete classes derived from DataTransferObject<T>

In this article
Back to top Copyright © 2025 Quantellia LLC.    Version 2.0.0 Revision 399     Last Updated 1/15/2025    DRAFT DOCUMENTATION. SUBJECT TO CHANGE