DmTableFactory ​
Namespace: MJCZone.DapperMatic.Models
Assembly: MJCZone.DapperMatic
Summary ​
Factory for creating DmTable instances for types.
static
public
Contents ​
Methods (9)
Methods ​
Method | Summary |
---|---|
Configure | Configure ahead of time any custom configuration for mapping types to DmTable instances. Call this ... |
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, ... |
GetTableName | There are times we just need the schema name and table name for a type, without the full DmTable ins... |
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.
GetType ​
void GetType()
ToString ​
void ToString()
Equals ​
void Equals()
GetHashCode ​
void GetHashCode()