Class DatabaseReaderMapper
Provides a way to map from a IDatabaseReader to a known object type.
Implements
Namespace: Paradigm.ORM.Data.Mappers
Assembly: Paradigm.ORM.Data.dll
Syntax
public class DatabaseReaderMapper : object, IDatabaseReaderMapper
Constructors
| Improve this Doc View SourceDatabaseReaderMapper(IServiceProvider, IDatabaseConnector, IColumnPropertyDescriptorCollection)
Initializes a new instance of the DatabaseReaderMapper class.
Declaration
public DatabaseReaderMapper(IServiceProvider serviceProvider, IDatabaseConnector connector, IColumnPropertyDescriptorCollection descriptor)
Parameters
Type | Name | Description |
---|---|---|
IServiceProvider | serviceProvider | The service provider. |
IDatabaseConnector | connector | A reference to a database connector. |
IColumnPropertyDescriptorCollection | descriptor | A column property descriptor collection to extract mapping information. |
DatabaseReaderMapper(IServiceProvider, IDatabaseConnector, Type)
Initializes a new instance of the DatabaseReaderMapper class.
Declaration
public DatabaseReaderMapper(IServiceProvider serviceProvider, IDatabaseConnector connector, Type type)
Parameters
Type | Name | Description |
---|---|---|
IServiceProvider | serviceProvider | The service provider. |
IDatabaseConnector | connector | A reference to a database connector. |
Type | type | The type containing the mapping information, or the reference to the mapping information. |
DatabaseReaderMapper(IServiceProvider, IColumnPropertyDescriptorCollection)
Initializes a new instance of the DatabaseReaderMapper class.
Declaration
public DatabaseReaderMapper(IServiceProvider serviceProvider, IColumnPropertyDescriptorCollection descriptor)
Parameters
Type | Name | Description |
---|---|---|
IServiceProvider | serviceProvider | The service provider. |
IColumnPropertyDescriptorCollection | descriptor | A column property descriptor collection to extract mapping information. |
DatabaseReaderMapper(IServiceProvider, Type)
Initializes a new instance of the DatabaseReaderMapper class.
Declaration
public DatabaseReaderMapper(IServiceProvider serviceProvider, Type type)
Parameters
Type | Name | Description |
---|---|---|
IServiceProvider | serviceProvider | The service provider. |
Type | type | The type containing the mapping information, or the reference to the mapping information. |
DatabaseReaderMapper(IDatabaseConnector, IColumnPropertyDescriptorCollection)
Initializes a new instance of the DatabaseReaderMapper class.
Declaration
public DatabaseReaderMapper(IDatabaseConnector connector, IColumnPropertyDescriptorCollection descriptor)
Parameters
Type | Name | Description |
---|---|---|
IDatabaseConnector | connector | A reference to a database connector. |
IColumnPropertyDescriptorCollection | descriptor | A column property descriptor collection to extract mapping information. |
DatabaseReaderMapper(IDatabaseConnector, Type)
Initializes a new instance of the DatabaseReaderMapper class.
Declaration
public DatabaseReaderMapper(IDatabaseConnector connector, Type type)
Parameters
Type | Name | Description |
---|---|---|
IDatabaseConnector | connector | A reference to a database connector. |
Type | type | The type containing the mapping information, or the reference to the mapping information. |
Properties
| Improve this Doc View SourceConnector
Gets the database connector.
Declaration
protected IDatabaseConnector Connector { get; }
Property Value
Type | Description |
---|---|
IDatabaseConnector |
Descriptor
Gets the table type descriptor used to extract the mapping information.
Declaration
protected IColumnPropertyDescriptorCollection Descriptor { get; }
Property Value
Type | Description |
---|---|
IColumnPropertyDescriptorCollection |
ServiceProvider
Gets the service provider.
Declaration
protected IServiceProvider ServiceProvider { get; }
Property Value
Type | Description |
---|---|
IServiceProvider |
ValueConverter
Gets the value converter.
Declaration
protected IValueConverter ValueConverter { get; }
Property Value
Type | Description |
---|---|
IValueConverter |
Methods
| Improve this Doc View SourceCreateInstance()
Creates a new instance of the required type before mapping values.
Declaration
protected virtual object CreateInstance()
Returns
Type | Description |
---|---|
System.Object |
Map(IDatabaseReader)
Gets a list of objects mapped from a database reader.
Declaration
public List<object> Map(IDatabaseReader reader)
Parameters
Type | Name | Description |
---|---|---|
IDatabaseReader | reader | A database reader cursor. |
Returns
Type | Description |
---|---|
List<System.Object> | A list of mapped objects. |
MapAsync(IDatabaseReader)
Gets a list of objects mapped from a database reader.
Declaration
public Task<List<object>> MapAsync(IDatabaseReader reader)
Parameters
Type | Name | Description |
---|---|---|
IDatabaseReader | reader | A database reader cursor. |
Returns
Type | Description |
---|---|
Task<List<System.Object>> | A list of mapped objects. |
MapRow(IDatabaseReader)
Maps one single row from the IDatabaseReader.
Declaration
protected virtual object MapRow(IDatabaseReader reader)
Parameters
Type | Name | Description |
---|---|---|
IDatabaseReader | reader | A database reader cursor. |
Returns
Type | Description |
---|---|
System.Object | A new instance of the known object type already mapped. |
Remarks
This method do not advance the reading cursor.
MapRowAsync(IDatabaseReader)
Maps one single row from the IDatabaseReader.
Declaration
protected virtual Task<object> MapRowAsync(IDatabaseReader reader)
Parameters
Type | Name | Description |
---|---|---|
IDatabaseReader | reader | A database reader cursor. |
Returns
Type | Description |
---|---|
Task<System.Object> | A new instance of the known object type already mapped. |
Remarks
This method do not advance the reading cursor.