Class BaseDataModel<TDataModel, TDomain>
Base abstract class representing a data model that can be mapped to/from a domain model.
Implements
Inherited Members
Namespace: Innovt.Cloud.AWS.Dynamo.Mapping
Assembly: Innovt.Cloud.AWS.Dynamo.dll
Syntax
public abstract class BaseDataModel<TDataModel, TDomain> : ITableMessage where TDataModel : class where TDomain : class
Type Parameters
Name | Description |
---|---|
TDataModel | The type of the data model. |
TDomain | The type of the domain model. |
Properties
| Edit this page View SourceEntityType
Gets or sets the entity type.
Declaration
[DynamoDBProperty]
public string EntityType { get; }
Property Value
Type | Description |
---|---|
string |
Id
Gets or sets the unique identifier.
Declaration
public string Id { get; set; }
Property Value
Type | Description |
---|---|
string |
Pk
Gets or sets the partition key for DynamoDB.
Declaration
[DynamoDBHashKey("PK")]
public string Pk { get; set; }
Property Value
Type | Description |
---|---|
string |
Sk
Gets or sets the sort key for DynamoDB.
Declaration
[DynamoDBRangeKey("SK")]
public string Sk { get; set; }
Property Value
Type | Description |
---|---|
string |
Methods
| Edit this page View SourceCustomDataModelMap(TDataModel, TDomain)
Custom mapping logic from domain model to data model.
Declaration
protected abstract void CustomDataModelMap(TDataModel dataModel, TDomain domain)
Parameters
Type | Name | Description |
---|---|---|
TDataModel | dataModel | The data model. |
TDomain | domain | The domain model. |
CustomDomainMap(TDomain, TDataModel)
Custom mapping logic from data model to domain model.
Declaration
protected abstract void CustomDomainMap(TDomain tDomain, TDataModel dataModel)
Parameters
Type | Name | Description |
---|---|---|
TDomain | tDomain | The domain model. |
TDataModel | dataModel | The data model. |
GetEntityType()
Protected abstract method to get the entity type.
Declaration
protected abstract string GetEntityType()
Returns
Type | Description |
---|---|
string | The entity type. |
ToDataModel(IList<TDomain>)
Converts a list of domain models to a list of data models.
Declaration
public IList<TDataModel> ToDataModel(IList<TDomain> domains)
Parameters
Type | Name | Description |
---|---|---|
IList<TDomain> | domains | The list of domain models to convert. |
Returns
Type | Description |
---|---|
IList<TDataModel> | The converted list of data models. |
ToDataModel(TDomain)
Converts a domain model to a data model.
Declaration
public virtual TDataModel ToDataModel(TDomain domain)
Parameters
Type | Name | Description |
---|---|---|
TDomain | domain | The domain model to convert. |
Returns
Type | Description |
---|---|
TDataModel | The converted data model. |
ToDomain(IList<TDataModel>)
Converts a list of data models to a list of domain models.
Declaration
public IList<TDomain> ToDomain(IList<TDataModel> dataModels)
Parameters
Type | Name | Description |
---|---|---|
IList<TDataModel> | dataModels | The list of data models to convert. |
Returns
Type | Description |
---|---|
IList<TDomain> | The converted list of domain models. |
ToDomain(TDataModel)
Converts a data model to a domain model.
Declaration
public virtual TDomain ToDomain(TDataModel dataModel)
Parameters
Type | Name | Description |
---|---|---|
TDataModel | dataModel | The data model to convert. |
Returns
Type | Description |
---|---|
TDomain | The converted domain model. |