Class FactIdentityComparerRegistry
- Namespace
- NRules
- Assembly
- NRules.dll
Registry of custom equality comparers for specific fact types used by IFactIdentityComparer when managing facts in the rules session.
public class FactIdentityComparerRegistry
- Inheritance
-
FactIdentityComparerRegistry
- Inherited Members
Properties
DefaultFactIdentityComparer
Default equality comparer used to compare fact identity, when inserting, updating, removing facts within the rules session. Used by IFactIdentityComparer when no custom comparer is registered for the fact type.
public IEqualityComparer<object> DefaultFactIdentityComparer { get; set; }
Property Value
Remarks
Built-in implementation uses IIdentityProvider if implemented by the fact, to compare fact identity. Otherwise, it uses the fact's equality for identity comparison.
Methods
RegisterComparer<TFact>(IEqualityComparer<TFact>)
Register a custom fact identity comparer for a specific fact type. Used by IFactIdentityComparer to compare identity of facts of the specified type.
public void RegisterComparer<TFact>(IEqualityComparer<TFact> comparer)
Parameters
comparer
IEqualityComparer<TFact>Custom fact identity comparer.
Type Parameters
TFact
Type of fact for which identity comparer is registered.
Remarks
Custom comparers are not polymorphic. They are used only for the exact type they are registered for.