DmTableFactory
Namespace: MJCZone.DapperMatic.Models
Assembly: MJCZone.DapperMatic
Summary
Factory for creating DmTable instances for types.
static public
Contents
Methods (13)
Methods
| Method | Summary |
|---|---|
| Configure | Configure ahead of time any custom configuration for mapping types to DmTable instances. Call this b... |
| Configure | Configure a specific type to your liking. This method can be used to customize the behavior of DmTab... |
| Configure | Configure a specific type to your liking. This method can be used to customize the behavior of DmTab... |
| GetTable | Returns an instance of a DmTable for the given type. If the type is not a valid DmTable, denoted by ... |
| GetTableName | There are times we just need the schema name and table name for a type, without the full DmTable ins... |
| GetPropertyInfo | |
| GetColumnName | Gets the column name for a property, considering various attributes that may specify the column name... |
| GetColumnName | |
| GetColumnName | Gets the column name for a property, considering various attributes that may specify the column name... |
| GetType | |
| ToString | |
| Equals | |
| GetHashCode |
Configure
Configure ahead of time any custom configuration for mapping types to DmTable instances. Call this before the application attempts to map types to DmTable instances, as the mappings are cached once generated the very first time.
void Configure(Type configure)Parameters
- configure (Type) - A delegate that receives the Type that is currently being mapped to a DmTable, and an initial DmTable that represents the default mapping before any customizations are applied. The delegate will run when the GetTable method is run for the first time each particular type.
Configure
Configure a specific type to your liking. This method can be used to customize the behavior of DmTable generation.
void Configure(DmTable} configure)Parameters
- configure (DmTable}) - A delegate that receives an initial DmTable that represents the default mapping before any customizations are applied. The type mapping is created immediately and the delegate is run immediately as well.
Configure
Configure a specific type to your liking. This method can be used to customize the behavior of DmTable generation.
void Configure(Type type, DmTable} configure)Parameters
- type (Type) - Type that should be mapped to a DmTable instance.
- configure (DmTable}) - A delegate that receives an initial DmTable that represents the default mapping before any customizations are applied. The type mapping is created immediately and the delegate is run immediately as well.
GetTable
Returns an instance of a DmTable for the given type. If the type is not a valid DmTable, denoted by the use of a DmTableAAttribute on the class, this method returns null.
DmTable GetTable(Type type)Parameters
- type (Type) - The type to map to a DmTable instance.
Returns
Type: DmTable
A DmTable instance representing the type.
GetTableName
There are times we just need the schema name and table name for a type, without the full DmTable instance. We also may need this information without causing a recursive call to GetTable, which may have foreign keys that reference a table with a foreign key back to it, leading to a stack overflow.
(string?, string) GetTableName(Type type, bool ignoreCache)Parameters
- type (Type) - The type to extract a schema and table name for.
- ignoreCache (bool) - If true, the cache will be ignored and the schema and table name will be extracted from the type's attributes. If false, the cache will be checked first, and if the type is found in the cache, the cached values will be returned.
Returns
Type: (string?, string)
A tuple containing the schema name and table name for the type.
GetPropertyInfo
GetPropertyInfo()GetColumnName
Gets the column name for a property, considering various attributes that may specify the column name.
string GetColumnName(PropertyInfo property)Parameters
- property (PropertyInfo) - The property to get the column name for.
Returns
Type: string
The column name for the property.
GetColumnName
GetColumnName()GetColumnName
Gets the column name for a property, considering various attributes that may specify the column name.
GetColumnName(PropertyInfo property, DmColumnAttribute columnAttribute)Parameters
- property (PropertyInfo) - The property to get the column name for.
- columnAttribute (DmColumnAttribute) - The DmColumnAttribute applied to the property, if any.
Returns
The column name for the property.
GetType
GetType()ToString
ToString()Equals
Equals()GetHashCode
GetHashCode()