Class Entity
Represents an abstract base class for entities in the domain model.
Inherited Members
Namespace: Innovt.Domain.Core.Model
Assembly: Innovt.Domain.Core.dll
Syntax
public abstract class Entity
Constructors
| Edit this page View SourceEntity()
Initializes a new instance of the Entity class.
Declaration
protected Entity()
Entity(int)
Initializes a new instance of the Entity class with a specific identifier.
Declaration
protected Entity(int id)
Parameters
Type | Name | Description |
---|---|---|
int | id | The identifier for the entity. |
Properties
| Edit this page View SourceCreatedAt
Gets or sets the date and time when the entity was created.
Declaration
public DateTimeOffset CreatedAt { get; set; }
Property Value
Type | Description |
---|---|
DateTimeOffset |
Id
Gets or sets the unique identifier for the entity.
Declaration
public virtual int Id { get; set; }
Property Value
Type | Description |
---|---|
int |
UpdatedAt
Gets or sets the date and time when the entity was last updated.
Declaration
public DateTimeOffset UpdatedAt { get; set; }
Property Value
Type | Description |
---|---|
DateTimeOffset |
Methods
| Edit this page View SourceAddDomainEvent(DomainEvent)
Adds a domain event to the entity.
Declaration
public Entity AddDomainEvent(DomainEvent domainEvent)
Parameters
Type | Name | Description |
---|---|---|
DomainEvent | domainEvent | The domain event to add. |
Returns
Type | Description |
---|---|
Entity |
Equals(object?)
Determines whether the specified object is equal to the current object.
Declaration
public override bool Equals(object? obj)
Parameters
Type | Name | Description |
---|---|---|
object | obj | The object to compare with the current object. |
Returns
Type | Description |
---|---|
bool | true if the specified object is equal to the current object; otherwise, false. |
Overrides
| Edit this page View SourceGetDomainEvents()
Gets the list of unprocessed domain events associated with the entity.
Declaration
public IReadOnlyList<DomainEvent> GetDomainEvents()
Returns
Type | Description |
---|---|
IReadOnlyList<DomainEvent> | A read-only list of unprocessed domain events. |
GetHashCode()
Serves as the default hash function.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
int | A hash code for the current object. |
Overrides
| Edit this page View SourceIsNew()
Checks if the entity is new (i.e., not persisted in the database yet).
Declaration
public bool IsNew()
Returns
Type | Description |
---|---|
bool |
|
SetAsNew()
Declaration
public Entity SetAsNew()
Returns
Type | Description |
---|---|
Entity |