ValueComparer<T> Constructors

Definition

Overloads

ValueComparer<T>(Boolean)

Creates a new ValueComparer<T> with a default comparison expression and a shallow copy for the snapshot.

ValueComparer<T>(Expression<Func<T,T,Boolean>>, Expression<Func<T,Int32>>)

Creates a new ValueComparer<T> with the given comparison expression. A shallow copy will be used for the snapshot.

ValueComparer<T>(Expression<Func<T,T,Boolean>>, Expression<Func<T,Int32>>, Expression<Func<T,T>>)

Creates a new ValueComparer<T> with the given comparison and snapshotting expressions.

ValueComparer<T>(Boolean)

Creates a new ValueComparer<T> with a default comparison expression and a shallow copy for the snapshot.

public ValueComparer (bool favorStructuralComparisons);
new Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer<'T> : bool -> Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer<'T>
Public Sub New (favorStructuralComparisons As Boolean)

Parameters

favorStructuralComparisons
Boolean

If true, then EF will use IStructuralEquatable if the type implements it. This is usually used when byte arrays act as keys.

Applies to

ValueComparer<T>(Expression<Func<T,T,Boolean>>, Expression<Func<T,Int32>>)

Creates a new ValueComparer<T> with the given comparison expression. A shallow copy will be used for the snapshot.

public ValueComparer (System.Linq.Expressions.Expression<Func<T,T,bool>> equalsExpression, System.Linq.Expressions.Expression<Func<T,int>> hashCodeExpression);
public ValueComparer (System.Linq.Expressions.Expression<Func<T?,T?,bool>> equalsExpression, System.Linq.Expressions.Expression<Func<T,int>> hashCodeExpression);
new Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer<'T> : System.Linq.Expressions.Expression<Func<'T, 'T, bool>> * System.Linq.Expressions.Expression<Func<'T, int>> -> Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer<'T>
Public Sub New (equalsExpression As Expression(Of Func(Of T, T, Boolean)), hashCodeExpression As Expression(Of Func(Of T, Integer)))

Parameters

equalsExpression
Expression<Func<T,T,Boolean>>

The comparison expression.

hashCodeExpression
Expression<Func<T,Int32>>

The associated hash code generator.

Applies to

ValueComparer<T>(Expression<Func<T,T,Boolean>>, Expression<Func<T,Int32>>, Expression<Func<T,T>>)

Creates a new ValueComparer<T> with the given comparison and snapshotting expressions.

public ValueComparer (System.Linq.Expressions.Expression<Func<T,T,bool>> equalsExpression, System.Linq.Expressions.Expression<Func<T,int>> hashCodeExpression, System.Linq.Expressions.Expression<Func<T,T>> snapshotExpression);
public ValueComparer (System.Linq.Expressions.Expression<Func<T?,T?,bool>> equalsExpression, System.Linq.Expressions.Expression<Func<T,int>> hashCodeExpression, System.Linq.Expressions.Expression<Func<T,T>> snapshotExpression);
new Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer<'T> : System.Linq.Expressions.Expression<Func<'T, 'T, bool>> * System.Linq.Expressions.Expression<Func<'T, int>> * System.Linq.Expressions.Expression<Func<'T, 'T>> -> Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer<'T>
Public Sub New (equalsExpression As Expression(Of Func(Of T, T, Boolean)), hashCodeExpression As Expression(Of Func(Of T, Integer)), snapshotExpression As Expression(Of Func(Of T, T)))

Parameters

equalsExpression
Expression<Func<T,T,Boolean>>

The comparison expression.

hashCodeExpression
Expression<Func<T,Int32>>

The associated hash code generator.

snapshotExpression
Expression<Func<T,T>>

The snapshot expression.

Remarks

Snapshotting is the process of creating a copy of the value into a snapshot so it can later be compared to determine if it has changed. For some types, such as collections, this needs to be a deep copy of the collection rather than just a shallow copy of the reference.

Applies to