Class RedbObjectExtensions

Assembly: redb.Core.dll

Extension methods for IRedbObject for convenient work with trees and objects

public static class RedbObjectExtensions

Inheritance

ObjectRedbObjectExtensions

Methods

CreateHierarchicalPath(IEnumerable<IRedbObject>, string)

Creates hierarchical path string for object

public static string CreateHierarchicalPath(this IEnumerable<IRedbObject> pathObjects, string separator = "/")

GetAge(IRedbObject, DateTime?)

Gets object age (time since creation)

public static TimeSpan GetAge(this IRedbObject obj, DateTime? referenceDate = null)

GetChildrenCountAsync<T>(IRedbObject, ITreeProvider)

Gets count of object children

public static Task<int> GetChildrenCountAsync<T>(this IRedbObject obj, ITreeProvider treeProvider) where T : class, new()

GetDebugInfo(IRedbObject)

Gets brief object information for debugging

public static string GetDebugInfo(this IRedbObject obj)

GetDescendantsCountAsync<T>(IRedbObject, ITreeProvider, int?)

Gets count of all object descendants

public static Task<int> GetDescendantsCountAsync<T>(this IRedbObject obj, ITreeProvider treeProvider, int? maxDepth = null) where T : class, new()

GetDisplayName(IRedbObject, bool)

Gets object display name with fallback logic

public static string GetDisplayName(this IRedbObject obj, bool includeId = true)

GetTimeSinceLastModification(IRedbObject, DateTime?)

Gets time since last object modification

public static TimeSpan GetTimeSinceLastModification(this IRedbObject obj, DateTime? referenceDate = null)

GetTreeLevelAsync<T>(IRedbObject, ITreeProvider)

OPTIMIZED version: Gets object level in tree (root = 0)

public static Task<int> GetTreeLevelAsync<T>(this IRedbObject obj, ITreeProvider treeProvider) where T : class, new()

HasStarted(IRedbObject, DateTime?)

Checks if object has started its validity

public static bool HasStarted(this IRedbObject obj, DateTime? checkDate = null)

IsActiveAt(IRedbObject, DateTime?)

Checks if object is active by timestamps

public static bool IsActiveAt(this IRedbObject obj, DateTime? checkDate = null)

IsAncestorOfAsync<T>(IRedbObject, IRedbObject, ITreeProvider)

Checks if object is an ancestor of the specified descendant

public static Task<bool> IsAncestorOfAsync<T>(this IRedbObject obj, IRedbObject potentialDescendant, ITreeProvider treeProvider) where T : class, new()

IsDescendantOfAsync<T>(IRedbObject, IRedbObject, ITreeProvider)

OPTIMIZED version: Checks if object is descendant of specified parent

public static Task<bool> IsDescendantOfAsync<T>(this IRedbObject obj, IRedbObject potentialAncestor, ITreeProvider treeProvider) where T : class, new()

IsExpired(IRedbObject, DateTime?)

Checks if object validity has expired

public static bool IsExpired(this IRedbObject obj, DateTime? checkDate = null)

IsLeafAsync<T>(IRedbObject, ITreeProvider)

Checks if object is a tree leaf (without children)

public static Task<bool> IsLeafAsync<T>(this IRedbObject obj, ITreeProvider treeProvider) where T : class, new()