EntityPropertyHelper
Provides helper methods for retrieving entity properties from a specified type.
メソッド
public static IEnumerable<EntityProperty> GetEntityProperties(Type type, Func<PropertyInfo, bool> filter)
result = EntityPropertyHelper.GetEntityProperties(type, filter)
Retrieves the entity properties for the specified type.
- type
- The type to retrieve entity properties from.
- filter
- An optional filter to apply to the property information.
戻り値: An enumerable collection of EntityProperty.
public static IEnumerable<EntityProperty> GetEntityProperties(Type type, EntityProperty parent, Func<PropertyInfo, bool> filter)
result = EntityPropertyHelper.GetEntityProperties(type, parent, filter)
Retrieves the entity properties for the specified type with a specified parent entity property.
- type
- The type to retrieve entity properties from.
- parent
- The parent EntityProperty in the hierarchy.
- filter
- An optional filter to apply to the property information.
戻り値: An enumerable collection of EntityProperty.
public static Type GetPropType(Type type, string name, Func<Type, string, Type> getVirtualProp)
result = EntityPropertyHelper.GetPropType(type, name, getVirtualProp)
Gets the type of a nested property specified by its name.
- type
- The type that contains the property.
- name
- The dot-separated name of the property.
- getVirtualProp
- An optional function to retrieve the type of a virtual property.
戻り値: The Type of the property if found; otherwise, null.
public static object GetPropValue(object entity, string name, Func<object, string, object> getVirtualProp, IDictionary<string, object> vars)
result = EntityPropertyHelper.GetPropValue(entity, name, getVirtualProp, vars)
Gets the value of a nested property from an object.
- entity
- The object to retrieve the value from.
- name
- The dot-separated name of the property.
- getVirtualProp
- An optional function to retrieve the value of a virtual property.
- vars
- An optional dictionary of variables for indexing.
戻り値: The value of the property if found; otherwise, null.
public static object GetPropValue(object entity, Type declaredType, string name, Func<object, string, object> getVirtualProp, IDictionary<string, object> vars)
result = EntityPropertyHelper.GetPropValue(entity, declaredType, name, getVirtualProp, vars)
Gets the value of a nested property from an object, reading it by the type the caller declares it under.
- entity
- The object to retrieve the value from.
- declaredType
- The type the name was resolved against, or to resolve it against the object itself. Naming the interface is what makes a member implemented explicitly for it readable, and what settles a name two interfaces both declare.
- name
- The dot-separated name of the property.
- getVirtualProp
- An optional function to retrieve the value of a virtual property.
- vars
- An optional dictionary of variables for indexing.
戻り値: The value of the property if found; otherwise, null.
public static IEnumerable<string> GetVars(Type type, string name, Func<Type, string, Type> getVirtualProp)
result = EntityPropertyHelper.GetVars(type, name, getVirtualProp)
Retrieves variable names from a nested property path for the specified type.
- type
- The type that contains the property.
- name
- The dot-separated property path.
- getVirtualProp
- An optional function to retrieve the type of a virtual property.
戻り値: An enumerable collection of variable names present in the property path.