Class BusinessEntityExtensions
Represents BusinessEntity extensions.
public static class BusinessEntityExtensions
- Inheritance
-
BusinessEntityExtensions
- Inherited Members
Methods
GetEntityTypes<TEntity>(TEntity, bool)
Gets the entity types from an entity.
public static IList<Type> GetEntityTypes<TEntity>(this TEntity entity, bool includeBaseTypes = true) where TEntity : BusinessEntity
Parameters
entityTEntityThe entity.
includeBaseTypesboolIndicates whether the base types is included to the result or not.
Returns
Type Parameters
TEntityThe entity type.
IsNavigationLoaded<TEntity, TProperty>(TEntity, Expression<Func<TEntity, TProperty>>)
Checks whether a navigation property (reference or collection) is loaded.
public static bool IsNavigationLoaded<TEntity, TProperty>(this TEntity entity, Expression<Func<TEntity, TProperty>> navigationPropertyExpression) where TEntity : BusinessEntity
Parameters
entityTEntityThe business entity.
navigationPropertyExpressionExpression<Func<TEntity, TProperty>>Expression that specifies the navigation property.
Returns
- bool
true if the navigation is loaded; otherwise, false.
Type Parameters
TEntityThe entity type.
TPropertyThe navigation property type.
Remarks
This method allows checking if a navigation property has been loaded without triggering lazy loading. Returns false if no lazy loader is present or if the entity was not loaded from the persistence layer.
Exceptions
- ArgumentException
Thrown when the property is not a valid navigation property (reference or collection).
SetNavigationLoaded<TEntity, TProperty>(TEntity, Expression<Func<TEntity, TProperty>>, bool)
Marks a navigation property (reference or collection) as loaded or not loaded.
public static void SetNavigationLoaded<TEntity, TProperty>(this TEntity entity, Expression<Func<TEntity, TProperty>> navigationPropertyExpression, bool loaded = true) where TEntity : BusinessEntity
Parameters
entityTEntityThe business entity.
navigationPropertyExpressionExpression<Func<TEntity, TProperty>>Expression that specifies the navigation property.
loadedboolA value indicating whether the navigation is loaded (true) or not loaded (false).
Type Parameters
TEntityThe entity type.
TPropertyThe navigation property type.
Remarks
This method is typically used by the persistence layer to indicate that a navigation property has been loaded from the database or should be marked as loaded. If no lazy loader is present, this method has no effect.
Exceptions
- ArgumentException
Thrown when the property is not a valid navigation property (reference or collection).