Table of Contents

Class BusinessEntity

Namespace
GroupeIsa.Neos.Domain.Entities
Assembly
GroupeIsa.Neos.Domain.Abstractions.dll

Represents a business entity.

public abstract class BusinessEntity : ICloneable
Inheritance
BusinessEntity
Implements
Inherited Members
Extension Methods

Constructors

BusinessEntity()

Initializes a new instance of the BusinessEntity class.

protected BusinessEntity()

BusinessEntity(ILazyLoader)

Initializes a new instance of the BusinessEntity class.

protected BusinessEntity(ILazyLoader lazyLoader)

Parameters

lazyLoader ILazyLoader

Lazy loader.

Properties

LazyLoader

Gets the lazy loader.

protected ILazyLoader? LazyLoader { get; }

Property Value

ILazyLoader

RowVersion

Gets or sets the row version for concurrency access.

[NotMapped]
public byte[] RowVersion { get; set; }

Property Value

byte[]

Methods

CheckMaxLength(Result, string, LocalizableString?, int)

Checks whether any localized string values exceed the specified maximum length and adds an error to the result if violations are found.

protected void CheckMaxLength(Result result, string propertyName, LocalizableString? value, int maxLength)

Parameters

result Result

The result object to which any validation errors will be added.

propertyName string

The name of the property being validated for maximum length.

value LocalizableString

The localized string value to validate. If null, no validation is performed.

maxLength int

The maximum allowed length for each localized string value. Must be greater than zero.

CheckMaxLength(Result, string, string?, int)

Checks whether the specified string value exceeds the allowed maximum length and adds a corresponding error to the result if necessary.

protected void CheckMaxLength(Result result, string propertyName, string? value, int maxLength)

Parameters

result Result

The result object to which an error will be added if the value exceeds the maximum length.

propertyName string

The name of the property being validated. Used to identify the source of the error.

value string

The string value to validate. If not null and its length exceeds the maximum, an error is added.

maxLength int

The maximum allowed length for the value. Must be a non-negative integer.

CheckNoLineBreak(Result, string, LocalizableString?)

Checks whether the specified localizable string value contains line breaks and adds an error to the result if line breaks are found.

protected void CheckNoLineBreak(Result result, string propertyName, LocalizableString? value)

Parameters

result Result

The result object to which an error will be added if any translation contains line breaks.

propertyName string

The name of the property being validated. Used to identify the source of the error.

value LocalizableString

The localizable string value to check for line breaks. If not null and any translation contains line breaks (\r or \n), an error is added.

Remarks

Use this method to enforce that single-line localizable text properties (with Multiline = false) do not contain line breaks. An error is added if any translation contains line breaks.

CheckNoLineBreak(Result, string, string?)

Checks whether the specified string value does not contain line breaks and adds an error to the result if line breaks are found.

protected void CheckNoLineBreak(Result result, string propertyName, string? value)

Parameters

result Result

The result object to which an error will be added if the value contains line breaks.

propertyName string

The name of the property being validated. Used to identify the source of the error.

value string

The string value to check for line breaks. If not null and contains line breaks (\r or \n), an error is added.

Remarks

Use this method to enforce that single-line text properties (with Multiline = false) do not contain line breaks. This is typically used during entity validation for text fields that should remain on a single line.

GetCollection<TRelated>(ref TRelated, string)

Gets a collection (if a lazy loader is present, the collection is lazy loaded if not already loaded).

protected TRelated GetCollection<TRelated>(ref TRelated navigationField, string navigationName = "") where TRelated : class

Parameters

navigationField TRelated

A reference to the backing field for the navigation.

navigationName string

The navigation property name.

Returns

TRelated

The loaded navigation property value, or the navigation property value unchanged if the loader is null.

Type Parameters

TRelated

The type of the navigation property.

Remarks

Lazy loading is only done on instances created by EF Core: https://github.com/dotnet/efcore/issues/33079.

GetReference<TRelated>(ref TRelated?, string)

Gets a reference (if a lazy loader is present, the reference is lazy loaded if not already loaded).

protected TRelated? GetReference<TRelated>(ref TRelated? navigationField, string navigationName = "") where TRelated : class

Parameters

navigationField TRelated

A reference to the backing field for the navigation.

navigationName string

The navigation property name.

Returns

TRelated

The loaded navigation property value, or the navigation property value unchanged if the loader is null.

Type Parameters

TRelated

The type of the navigation property.

GetRequiredReference<TRelated>(ref TRelated, string)

Gets a required reference (if a lazy loader is present, the reference is lazy loaded if not already loaded).

protected TRelated GetRequiredReference<TRelated>(ref TRelated navigationField, string navigationName = "") where TRelated : class

Parameters

navigationField TRelated

A reference to the backing field for the navigation.

navigationName string

The navigation property name.

Returns

TRelated

The loaded navigation property value, or the navigation property value unchanged if the loader is null.

Type Parameters

TRelated

The type of the navigation property.