Table of Contents

Class ValueObject

Namespace
KYS.EFCore.Library
Assembly
KYS.EFCore.Library.dll

Base class for value objects: objects without identity that are equal when all their equality components (see GetEqualityComponents()) are equal.

public abstract class ValueObject
Inheritance
ValueObject
Inherited Members

Methods

EqualOperator(ValueObject, ValueObject)

Helper for implementing operator == in derived classes.

protected static bool EqualOperator(ValueObject left, ValueObject right)

Parameters

left ValueObject

The first value object to compare.

right ValueObject

The second value object to compare.

Returns

bool

true if both are null or equal; otherwise false.

Equals(object)

Determines whether the specified object is a value object of the same type with equal components.

public override bool Equals(object obj)

Parameters

obj object

The object to compare with this value object.

Returns

bool

true if the objects are equal; otherwise false.

GetEqualityComponents()

Returns the values that define the equality of the value object, always in the same order.

protected abstract IEnumerable<object> GetEqualityComponents()

Returns

IEnumerable<object>

The equality components.

GetHashCode()

Returns a hash code combined from the hash codes of the equality components.

public override int GetHashCode()

Returns

int

A hash code for the current value object.

NotEqualOperator(ValueObject, ValueObject)

Helper for implementing operator != in derived classes.

protected static bool NotEqualOperator(ValueObject left, ValueObject right)

Parameters

left ValueObject

The first value object to compare.

right ValueObject

The second value object to compare.

Returns

bool

true if the value objects are not equal; otherwise false.