Owneat Technical Guide main Help

Class ProductBase

Namespace: Restaurant.Domain.Base
Assembly: Restaurant.Domain.dll

public abstract class ProductBase : Entity, IAggregateRoot, IAuditable, ISortableElement

Inheritance

object ← Entity ← ProductBase

Derived

Formula, Product

Implements

IAggregateRoot, IAuditable, ISortableElement

Inherited Members

Entity.Id, Entity.CreatedAt, Entity.UpdatedAt, Entity.DomainEvents, Entity.EmitDomainEvent\(IDomainEvent\)), object.Equals\(object?\), object.Equals\(object?, object?\), object.GetHashCode\(\), object.GetType\(\), object.MemberwiseClone\(\), object.ReferenceEquals\(object?, object?\), object.ToString\(\)

Properties

CategoryId

Id of the parent Restaurant.Domain.Aggregates.CategoryAggregate.Category.

[ForeignKey("CategoryId")] public Guid? CategoryId { get; init; }

Property Value

Guid?

Description

Description of the Restaurant.Domain.Aggregates.ProductAggregate.Product.

[MaxLength(200)] public string Description { get; set; }

Property Value

string

Discriminator

Discriminator that state the type of the inheritor.

[MaxLength(50)] [NotMapped] public virtual string Discriminator { get; init; }

Property Value

string

DisplayImageUrl

URL of the Restaurant.Domain.Aggregates.ProductAggregate.Product image.

[MaxLength(500)] public string DisplayImageUrl { get; set; }

Property Value

string

ExternalPaymentId

Id of the product for catalog on payment provider.

[MaxLength(50)] public string? ExternalPaymentId { get; set; }

Property Value

string?

IsAvailable

Is the Restaurant.Domain.Aggregates.ProductAggregate.Product available.

[Required] public bool IsAvailable { get; set; }

Property Value

bool

Name

Name of the Restaurant.Domain.Aggregates.ProductAggregate.Product.

[Required] [MaxLength(50)] public string Name { get; set; }

Property Value

string

RestaurantId

Id of the restaurant where the product is served.

public Guid RestaurantId { get; init; }

Property Value

Guid

SortingIndex

Position of the Restaurant.Domain.Aggregates.ProductAggregate.Product in it's Restaurant.Domain.Aggregates.CategoryAggregate.Category.

[Required] public int SortingIndex { get; set; }

Property Value

int

UnitPrice

UnitPrice of the Restaurant.Domain.Aggregates.ProductAggregate.Product.

[Required] [Column(TypeName = "decimal(6,2)")] public double UnitPrice { get; set; }

Property Value

double

Methods

DeleteExternalPaymentId\(\)

Delete the Restaurant.Domain.Base.ProductBase.ExternalPaymentId of a Restaurant.Domain.Aggregates.ProductAggregate.Product.

public void DeleteExternalPaymentId()

SendProductBaseAvailabilityChangedEvent\(\)

protected void SendProductBaseAvailabilityChangedEvent()

UpdateAvailability\(bool\)

public void UpdateAvailability(bool isAvailable)

Parameters

isAvailable bool

UpdateBasicInfos\(string, string, string, double\)

Update the Restaurant.Domain.Aggregates.ProductAggregate.Product infos.

public void UpdateBasicInfos(string name, string description, string displayImageUrl, double unitPrice)

Parameters

name string

description string

displayImageUrl string

unitPrice double

UpdateExternalPaymentId\(string\)

Update the Restaurant.Domain.Base.ProductBase.ExternalPaymentId of a Restaurant.Domain.Aggregates.ProductAggregate.Product.

public void UpdateExternalPaymentId(string externalPaymentId)

Parameters

externalPaymentId string

UpdateImageUrl\(string\)

Update the Restaurant.Domain.Aggregates.ProductAggregate.Product image url.

public void UpdateImageUrl(string productImageUrl)

Parameters

productImageUrl string

UpdateSortingIndex\(int\)

Update the position of the Restaurant.Domain.Base.ProductBase in its Restaurant.Domain.Aggregates.CategoryAggregate.Category.

public void UpdateSortingIndex(int newSortingIndex)

Parameters

newSortingIndex int

New position.

Last modified: 21 May 2024