C# Class WeenyMapper.Conventions.DefaultConvention

Inheritance: IConvention
Mostrar archivo Open project: erikojebo/WeenyMapper Class Usage Examples

Public Methods

Method Description
GetColumnName ( PropertyInfo propertyInfo ) : string

Returns the column name for a given property Default: Same column name as property name

GetManyToOneForeignKeyColumnName ( PropertyInfo propertyInfo ) : string

Returns the foreign key column name for a navigation property from a child entity to a parent (many to one) Default: Property name + Id, so the property "BlogPost.Blog" returns the column name "BlogId"

This method is called when a join is made which includes a child->parent navigation property.

GetTableName ( Type entityType ) : string

Returns the table name for a given class Default: Same table name as class name

HasIdentityId ( Type entityType ) : bool

Returns true if the given class represents a database table with an identity primary key column, false otherwise Default: True if the property representing the primary key is an integer property, false otherwise

IsIdProperty ( PropertyInfo propertyInfo ) : bool

Returns true if the given property represents the primary key column in the database table Default: True if the columns is called "Id" false otherwise

ShouldMapProperty ( PropertyInfo propertyInfo ) : bool

Returns true if the property should be included in queries/statements. If false, the property is ignored entirely by WeenyMapper. Default: Non-static properties with public getter and setter are mapped, all other properties are ignored

Method Details

GetColumnName() public method

Returns the column name for a given property Default: Same column name as property name
public GetColumnName ( PropertyInfo propertyInfo ) : string
propertyInfo System.Reflection.PropertyInfo The PropertyInfo for which to determine the underlying database column name
return string

GetManyToOneForeignKeyColumnName() public method

Returns the foreign key column name for a navigation property from a child entity to a parent (many to one) Default: Property name + Id, so the property "BlogPost.Blog" returns the column name "BlogId"
This method is called when a join is made which includes a child->parent navigation property.
public GetManyToOneForeignKeyColumnName ( PropertyInfo propertyInfo ) : string
propertyInfo System.Reflection.PropertyInfo The navigation property used in the join
return string

GetTableName() public method

Returns the table name for a given class Default: Same table name as class name
public GetTableName ( Type entityType ) : string
entityType System.Type The type of the entity for which to determine the underlying database table name
return string

HasIdentityId() public method

Returns true if the given class represents a database table with an identity primary key column, false otherwise Default: True if the property representing the primary key is an integer property, false otherwise
public HasIdentityId ( Type entityType ) : bool
entityType System.Type The type for which is should be determined if the underlying database table has an identity primary key column
return bool

IsIdProperty() public method

Returns true if the given property represents the primary key column in the database table Default: True if the columns is called "Id" false otherwise
public IsIdProperty ( PropertyInfo propertyInfo ) : bool
propertyInfo System.Reflection.PropertyInfo The PropertyInfo for which is should be determined if WeenyMapper should attempt to map it against a column in the database or not
return bool

ShouldMapProperty() public method

Returns true if the property should be included in queries/statements. If false, the property is ignored entirely by WeenyMapper. Default: Non-static properties with public getter and setter are mapped, all other properties are ignored
public ShouldMapProperty ( PropertyInfo propertyInfo ) : bool
propertyInfo System.Reflection.PropertyInfo The PropertyInfo for which is should be determined if WeenyMapper should attempt to map it against a column in the database or not
return bool