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
leftValueObjectThe first value object to compare.
rightValueObjectThe second value object to compare.
Returns
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
objobjectThe object to compare with this value object.
Returns
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
leftValueObjectThe first value object to compare.
rightValueObjectThe second value object to compare.