Class TypeAccessor
- Namespace
- FluentCommand.Reflection
- Assembly
- FluentCommand.dll
A class for accessing type reflection information.
public class TypeAccessor
- Inheritance
-
TypeAccessor
- Inherited Members
Constructors
TypeAccessor(Type)
Initializes a new instance of the TypeAccessor class.
public TypeAccessor(Type type)
Parameters
Properties
Name
Gets the name of the Type.
public string Name { get; }
Property Value
- string
The name of the Type.
TableName
Gets the name of the table the class is mapped to.
public string TableName { get; }
Property Value
- string
The name of the table the class is mapped to.
TableSchema
Gets the schema of the table the class is mapped to.
public string TableSchema { get; }
Property Value
- string
The schema of the table the class is mapped to.
Type
Gets the Type this accessor is for.
public Type Type { get; }
Property Value
Methods
Create()
Creates a new instance of accessors type.
public object Create()
Returns
- object
A new instance of accessors type.
Find(string)
Searches for the public property or field with the specified name.
public IMemberAccessor Find(string name)
Parameters
name
stringThe name of the property or field to find.
Returns
- IMemberAccessor
An IMemberAccessor instance for the property or field if found; otherwise
null
.
Find(string, BindingFlags)
Searches for the specified property or field, using the specified binding constraints.
public IMemberAccessor Find(string name, BindingFlags flags)
Parameters
name
stringThe name of the property or field to find.
flags
BindingFlagsA bitmask comprised of one or more BindingFlags that specify how the search is conducted.
Returns
- IMemberAccessor
An IMemberAccessor instance for the property or field if found; otherwise
null
.
FindColumn(string)
Searches for the public property with the specified column name.
public IMemberAccessor FindColumn(string name)
Parameters
name
stringThe name of the property or field to find.
Returns
- IMemberAccessor
An IMemberAccessor instance for the property or field if found; otherwise
null
.
FindColumn(string, BindingFlags)
Searches for the specified property the specified column name and binding constraints.
public IMemberAccessor FindColumn(string name, BindingFlags flags)
Parameters
name
stringThe name of the property to find.
flags
BindingFlagsA bitmask comprised of one or more BindingFlags that specify how the search is conducted.
Returns
- IMemberAccessor
An IMemberAccessor instance for the property if found; otherwise
null
.
FindField(string)
Searches for the specified field with the specified name.
public IMemberAccessor FindField(string name)
Parameters
name
stringThe name of the field to find.
Returns
- IMemberAccessor
An IMemberAccessor instance for the field if found; otherwise
null
.
FindField(string, BindingFlags)
Searches for the specified field, using the specified binding constraints.
public IMemberAccessor FindField(string name, BindingFlags flags)
Parameters
name
stringThe name of the field to find.
flags
BindingFlagsA bitmask comprised of one or more BindingFlags that specify how the search is conducted.
Returns
- IMemberAccessor
An IMemberAccessor instance for the field if found; otherwise
null
.
FindMethod(string)
Finds the method with the spcified name
.
public IMethodAccessor FindMethod(string name)
Parameters
name
stringThe name of the method.
Returns
- IMethodAccessor
An IMemberAccessor for the method.
FindMethod(string, params Type[])
Finds the method with the spcified name
.
public IMethodAccessor FindMethod(string name, params Type[] parameterTypes)
Parameters
Returns
- IMethodAccessor
An IMemberAccessor for the method.
FindMethod(string, Type[], BindingFlags)
Finds the method with the spcified name
.
public IMethodAccessor FindMethod(string name, Type[] parameterTypes, BindingFlags flags)
Parameters
name
stringThe name of the method.
parameterTypes
Type[]The method parameter types.
flags
BindingFlagsThe binding flags to search.
Returns
- IMethodAccessor
An IMemberAccessor for the method.
FindProperty(string)
Searches for the public property with the specified name
.
public IMemberAccessor FindProperty(string name)
Parameters
name
stringThe name of the property to find.
Returns
- IMemberAccessor
An IMemberAccessor instance for the property if found; otherwise
null
.
FindProperty(string, BindingFlags)
Searches for the specified property, using the specified binding constraints.
public IMemberAccessor FindProperty(string name, BindingFlags flags)
Parameters
name
stringThe name of the property to find.
flags
BindingFlagsA bitmask comprised of one or more BindingFlags that specify how the search is conducted.
Returns
- IMemberAccessor
An IMemberAccessor instance for the property if found; otherwise
null
.
FindProperty<T>(Expression<Func<T>>)
Searches for the property using a property expression.
public IMemberAccessor FindProperty<T>(Expression<Func<T>> propertyExpression)
Parameters
propertyExpression
Expression<Func<T>>The property expression (e.g. p => p.PropertyName)
Returns
- IMemberAccessor
An IMemberAccessor instance for the property if found; otherwise
null
.
Type Parameters
T
The object type containing the property specified in the expression.
Exceptions
- ArgumentNullException
Thrown if the
propertyExpression
is null.- ArgumentException
Thrown when the expression is:
Not a MemberExpression
The MemberExpression does not represent a property.
Or, the property is static.
FindProperty<TSource, TValue>(Expression<Func<TSource, TValue>>)
Searches for the property using a property expression.
public IMemberAccessor FindProperty<TSource, TValue>(Expression<Func<TSource, TValue>> propertyExpression)
Parameters
propertyExpression
Expression<Func<TSource, TValue>>The property expression (e.g. p => p.PropertyName)
Returns
- IMemberAccessor
An IMemberAccessor instance for the property if found; otherwise
null
.
Type Parameters
TSource
The object type containing the property specified in the expression.
TValue
The type of the value.
Exceptions
- ArgumentNullException
Thrown if the
propertyExpression
is null.- ArgumentException
Thrown when the expression is:
Not a MemberExpression
The MemberExpression does not represent a property.
Or, the property is static.
GetAccessor(Type)
Gets the TypeAccessor for the specified Type.
public static TypeAccessor GetAccessor(Type type)
Parameters
type
TypeThe Type to get the accessor for.
Returns
GetAccessor<T>()
Gets the TypeAccessor for the specified Type.
public static TypeAccessor GetAccessor<T>()
Returns
Type Parameters
T
The Type to get the accessor for.
GetProperties()
Gets the property member accessors for the Type.
public IEnumerable<IMemberAccessor> GetProperties()
Returns
- IEnumerable<IMemberAccessor>
An IEnumerable<T> of IMemberAccessor instances for the Type.
GetProperties(BindingFlags)
Gets the property member accessors for the Type using the specified flags.
public IEnumerable<IMemberAccessor> GetProperties(BindingFlags flags)
Parameters
flags
BindingFlags
Returns
- IEnumerable<IMemberAccessor>
An IEnumerable<T> of IMemberAccessor instances for the Type.