#### [DiGi\.Core\.Relation](DiGi.Core.Relation.Overview.md 'DiGi\.Core\.Relation\.Overview') ## DiGi\.Core\.Relation Namespace ### Classes ## Modify Class Provides methods for modifying relations\. ```csharp public static class Modify ``` Inheritance [System\.Object](https://learn.microsoft.com/en-us/dotnet/api/system.object 'System\.Object') → Modify ### Methods ## Modify\.RemoveFirst\\(this List\, IReference\) Method Removes the first occurrence of the specified reference from the list\. ```csharp public static bool RemoveFirst(this System.Collections.Generic.List? references, DiGi.Core.Interfaces.IReference? reference) where TReference : DiGi.Core.Interfaces.IReference; ``` #### Type parameters `TReference` The type of elements in the references list\. #### Parameters `references` [System\.Collections\.Generic\.List<](https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.list-1 'System\.Collections\.Generic\.List\`1')[TReference](DiGi.Core.Relation.md#DiGi.Core.Relation.Modify.RemoveFirst_TReference_(thisSystem.Collections.Generic.List_TReference_,DiGi.Core.Interfaces.IReference).TReference 'DiGi\.Core\.Relation\.Modify\.RemoveFirst\\(this System\.Collections\.Generic\.List\, DiGi\.Core\.Interfaces\.IReference\)\.TReference')[>](https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.list-1 'System\.Collections\.Generic\.List\`1') The list of references to remove the item from\. `reference` [DiGi\.Core\.Interfaces\.IReference](https://learn.microsoft.com/en-us/dotnet/api/digi.core.interfaces.ireference 'DiGi\.Core\.Interfaces\.IReference') The reference to remove from the list\. #### Returns [System\.Boolean](https://learn.microsoft.com/en-us/dotnet/api/system.boolean 'System\.Boolean') True if the reference was successfully removed; otherwise, false\. ## Query Class Provides methods for querying relations\. ```csharp public static class Query ``` Inheritance [System\.Object](https://learn.microsoft.com/en-us/dotnet/api/system.object 'System\.Object') → Query ### Methods ## Query\.IsValid\(this IRelation, Type, RelationSide\) Method Determines whether the relation is valid for the specified type and side\. ```csharp public static bool IsValid(this DiGi.Core.Relation.Interfaces.IRelation? relation, System.Type? type, DiGi.Core.Relation.Enums.RelationSide relationSide); ``` #### Parameters `relation` [IRelation](DiGi.Core.Relation.Interfaces.md#DiGi.Core.Relation.Interfaces.IRelation 'DiGi\.Core\.Relation\.Interfaces\.IRelation') The relation to validate\. `type` [System\.Type](https://learn.microsoft.com/en-us/dotnet/api/system.type 'System\.Type') The type to check against\. `relationSide` [RelationSide](DiGi.Core.Relation.Enums.md#DiGi.Core.Relation.Enums.RelationSide 'DiGi\.Core\.Relation\.Enums\.RelationSide') The side of the relation\. #### Returns [System\.Boolean](https://learn.microsoft.com/en-us/dotnet/api/system.boolean 'System\.Boolean') True if the relation is valid; otherwise, false\. ## Query\.UniqueReferences\(this IRelation, RelationSide\) Method Gets the set of unique references from the relation on the specified side\. ```csharp public static System.Collections.Generic.HashSet? UniqueReferences(this DiGi.Core.Relation.Interfaces.IRelation? relation, DiGi.Core.Relation.Enums.RelationSide relationSide); ``` #### Parameters `relation` [IRelation](DiGi.Core.Relation.Interfaces.md#DiGi.Core.Relation.Interfaces.IRelation 'DiGi\.Core\.Relation\.Interfaces\.IRelation') The relation to retrieve unique references from\. `relationSide` [RelationSide](DiGi.Core.Relation.Enums.md#DiGi.Core.Relation.Enums.RelationSide 'DiGi\.Core\.Relation\.Enums\.RelationSide') The side of the relation to check\. #### Returns [System\.Collections\.Generic\.HashSet<](https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.hashset-1 'System\.Collections\.Generic\.HashSet\`1')[DiGi\.Core\.Interfaces\.IUniqueReference](https://learn.microsoft.com/en-us/dotnet/api/digi.core.interfaces.iuniquereference 'DiGi\.Core\.Interfaces\.IUniqueReference')[>](https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.hashset-1 'System\.Collections\.Generic\.HashSet\`1') A set of unique references, or null if none exist\.