ClassExpression
A helper class for extracting class objects via the Linq.Expressions namespace. All operations are pre-compiled.
GetEntitiesPropertyValues
Returns the property values of a collection of entities as an array of the specified TResult type.
The following example extracts all Id values from an array of Person objects.
var people = GetPeople(); // As a given variable
var keys = ClassExpression.GetEntitiesPropertyValues<Person, long>(people, "Id");
// Do the stuffs for the 'keys' here
Extraction is also supported via Field, DbField, or ClassProperty objects.
GetProperties
Returns a list of ClassProperty objects for the target entity.
var properties = ClassExpression.GetProperties<Person>();
// Do the stuffs for the 'properties' here
Use PropertyCache when extracting class properties, as it caches results for reuse.
GetPropertiesAndValues
Returns a list of PropertyValue objects containing the properties and their values for the target entity.
var propertiesAndValues = ClassExpression.GetProperties<Person>(person);
// Do the stuffs for the 'propertiesAndValues' here