Show / Hide Table of Contents

    Class Mapper

    This static class contains the logic for mapping database parameters to/from properties.

    Inheritance
    System.Object
    Mapper
    Inherited Members
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.ToString()
    Namespace: ArgentSea
    Assembly: ArgentSea.dll
    Syntax
    public static class Mapper

    Methods

    | Improve this Doc View Source

    FromDataReader<TModel>(DbDataReader, ILogger)

    Accepts a data reader object and returns a list of objects of the specified type, one for each record.

    Declaration
    public static IList<TModel> FromDataReader<TModel>(DbDataReader rdr, ILogger logger)
        where TModel : class, new()
    Parameters
    Type Name Description
    System.Data.Common.DbDataReader rdr

    The data reader, set to the current result set.

    Microsoft.Extensions.Logging.ILogger logger

    The logger instance to write any processing or debug information to.

    Returns
    Type Description
    System.Collections.Generic.IList<TModel>

    A list of objects of the specified type, one for each result.

    Type Parameters
    Name Description
    TModel

    The type of the list result

    | Improve this Doc View Source

    FromDataReader<TShard, TModel>(TShard, DbDataReader, ILogger)

    Accepts a data reader object and returns a list of objects of the specified type, one for each record.

    Declaration
    public static IList<TModel> FromDataReader<TShard, TModel>(TShard shardId, DbDataReader rdr, ILogger logger)
        where TShard : IComparable where TModel : class, new()
    Parameters
    Type Name Description
    TShard shardId
    System.Data.Common.DbDataReader rdr

    The data reader, set to the current result set.

    Microsoft.Extensions.Logging.ILogger logger

    The logger instance to write any processing or debug information to.

    Returns
    Type Description
    System.Collections.Generic.IList<TModel>

    A list of objects of the specified type, one for each result.

    Type Parameters
    Name Description
    TShard
    TModel

    The type of the list result

    | Improve this Doc View Source

    MapToInParameters<TModel>(DbParameterCollection, TModel, ILogger)

    Accepts a Sql Parameter collection and appends Sql input parameters whose values correspond to the provided object properties and MapTo attributes.

    Declaration
    public static DbParameterCollection MapToInParameters<TModel>(this DbParameterCollection parameters, TModel model, ILogger logger)
        where TModel : class, new()
    Parameters
    Type Name Description
    System.Data.Common.DbParameterCollection parameters

    A parameter collection, generally belonging to a ADO.Net Command object.

    TModel model

    An object model instance. The property values are use as parameter values.

    Microsoft.Extensions.Logging.ILogger logger

    The logger instance to write any processing or debug information to.

    Returns
    Type Description
    System.Data.Common.DbParameterCollection
    Type Parameters
    Name Description
    TModel

    The type of the object. The "MapTo" attributes are used to create the Sql metadata and columns.

    | Improve this Doc View Source

    MapToInParameters<TModel>(DbParameterCollection, TModel, HashSet<String>, ILogger)

    Accepts a Sql Parameter collection and appends Sql input parameters whose values correspond to the provided object properties and MapTo attributes.

    Declaration
    public static DbParameterCollection MapToInParameters<TModel>(this DbParameterCollection parameters, TModel model, HashSet<string> ignoreParameters, ILogger logger)
        where TModel : class, new()
    Parameters
    Type Name Description
    System.Data.Common.DbParameterCollection parameters

    A parameter collection, generally belonging to a ADO.Net Command object.

    TModel model

    An object model instance. The property values are use as parameter values.

    System.Collections.Generic.HashSet<System.String> ignoreParameters

    A lists of parameter names that should not be created. Each entry must exactly match the parameter name, including prefix and casing.

    Microsoft.Extensions.Logging.ILogger logger

    The logger instance to write any processing or debug information to.

    Returns
    Type Description
    System.Data.Common.DbParameterCollection
    Type Parameters
    Name Description
    TModel

    The type of the object. The "MapTo" attributes are used to create the Sql metadata and columns.

    | Improve this Doc View Source

    MapToOutParameters(DbParameterCollection, Type, ILogger)

    Accepts a Sql Parameter collection and appends Sql output parameters corresponding to the MapTo attributes.

    Declaration
    public static DbParameterCollection MapToOutParameters(this DbParameterCollection parameters, Type TModel, ILogger logger)
    Parameters
    Type Name Description
    System.Data.Common.DbParameterCollection parameters

    A parameter collection, possibly belonging to a ADO.Net Command object or a QueryParmaters object.

    System.Type TModel

    The type of the object. The "MapTo" attributes are used to create the Sql parameter types.

    Microsoft.Extensions.Logging.ILogger logger

    The logger instance to write any processing or debug information to.

    Returns
    Type Description
    System.Data.Common.DbParameterCollection
    | Improve this Doc View Source

    MapToOutParameters(DbParameterCollection, Type, HashSet<String>, ILogger)

    Accepts a Sql Parameter collection and appends Sql output parameters corresponding to the MapTo attributes.

    Declaration
    public static DbParameterCollection MapToOutParameters(this DbParameterCollection parameters, Type TModel, HashSet<string> ignoreParameters, ILogger logger)
    Parameters
    Type Name Description
    System.Data.Common.DbParameterCollection parameters

    A parameter collection, generally belonging to a ADO.Net Command object.

    System.Type TModel
    System.Collections.Generic.HashSet<System.String> ignoreParameters

    A lists of parameter names that should not be created.

    Microsoft.Extensions.Logging.ILogger logger

    The logger instance to write any processing or debug information to.

    Returns
    Type Description
    System.Data.Common.DbParameterCollection
    | Improve this Doc View Source

    MapToOutParameters<TModel>(DbParameterCollection, ILogger)

    Accepts a Sql Parameter collection and appends Sql output parameters corresponding to the MapTo attributes.

    Declaration
    public static DbParameterCollection MapToOutParameters<TModel>(this DbParameterCollection parameters, ILogger logger)
        where TModel : class, new()
    Parameters
    Type Name Description
    System.Data.Common.DbParameterCollection parameters

    A parameter collection, possibly belonging to a ADO.Net Command object or a QueryParmaters object.

    Microsoft.Extensions.Logging.ILogger logger

    The logger instance to write any processing or debug information to.

    Returns
    Type Description
    System.Data.Common.DbParameterCollection

    The DbParameterCollection, enabling a fluent API.

    Type Parameters
    Name Description
    TModel

    The type of the object. The "MapTo" attributes are used to create the Sql parameter types.

    | Improve this Doc View Source

    MapToOutParameters<TModel>(DbParameterCollection, HashSet<String>, ILogger)

    Accepts a Sql Parameter collection and appends Sql output parameters corresponding to the MapTo attributes.

    Declaration
    public static DbParameterCollection MapToOutParameters<TModel>(this DbParameterCollection parameters, HashSet<string> ignoreParameters, ILogger logger)
        where TModel : class, new()
    Parameters
    Type Name Description
    System.Data.Common.DbParameterCollection parameters

    A parameter collection, possibly belonging to a ADO.Net Command object or a QueryParmaters object.

    System.Collections.Generic.HashSet<System.String> ignoreParameters

    A lists of parameter names that should not be created.

    Microsoft.Extensions.Logging.ILogger logger

    The logger instance to write any processing or debug information to.

    Returns
    Type Description
    System.Data.Common.DbParameterCollection

    The DbParameterCollection, enabling a fluent API.

    Type Parameters
    Name Description
    TModel

    The type of the object. The "MapTo" attributes are used to create the Sql parameter types.

    | Improve this Doc View Source

    QueryResultsHandler<TShard, TModel, TReaderResult0, TReaderResult1, TReaderResult2, TReaderResult3, TReaderResult4, TReaderResult5, TReaderResult6, TReaderResult7, TOutResult>(TShard, String, Object, DbDataReader, DbParameterCollection, String, ILogger)

    A function whose signature cooresponds to delegate QueryResultModelHandler and is used to map the provided model type(s) to query results.

    Declaration
    public static TModel QueryResultsHandler<TShard, TModel, TReaderResult0, TReaderResult1, TReaderResult2, TReaderResult3, TReaderResult4, TReaderResult5, TReaderResult6, TReaderResult7, TOutResult>(TShard shardId, string sprocName, object notUsed, DbDataReader rdr, DbParameterCollection parameters, string connectionDescription, ILogger logger)
        where TShard : IComparable where TModel : class, new()
        where TReaderResult0 : class, new()
        where TReaderResult1 : class, new()
        where TReaderResult2 : class, new()
        where TReaderResult3 : class, new()
        where TReaderResult4 : class, new()
        where TReaderResult5 : class, new()
        where TReaderResult6 : class, new()
        where TReaderResult7 : class, new()
        where TOutResult : class, new()
    Parameters
    Type Name Description
    TShard shardId

    This value will be provided to ShardKey or ShardChild objects. If not using sharded data, any provided value will be ignored.

    System.String sprocName

    The name of the stored procedure is used to cache the mapping metadata and also for provide richer logging information.

    System.Object notUsed

    This parameter is required to conform to the QueryResultModelHandler delegate signature. This argument should be null.

    System.Data.Common.DbDataReader rdr

    The data reader returned by the query.

    System.Data.Common.DbParameterCollection parameters

    The output parameters returned by the query.

    System.String connectionDescription

    The connection description is used to enrich logging information.

    Microsoft.Extensions.Logging.ILogger logger

    The logging instance to use for any logging requirements.

    Returns
    Type Description
    TModel

    An instance of TResult, with properties matching the provided data.

    Type Parameters
    Name Description
    TShard

    The type of the shardId value. Can be any value type if not used.

    TModel

    This is the expected return type of the handler.

    TReaderResult0

    The first result set from data reader will be mapped an object or property of this type. Set to Mapper.DummyType if not used.

    TReaderResult1

    The second result set from data reader will be mapped an object or property of this type. Set to Mapper.DummyType if not used.

    TReaderResult2

    The third result set from data reader will be mapped an object or property of this type. Set to Mapper.DummyType if not used.

    TReaderResult3

    The forth result set from data reader will be mapped an object or property of this type. Set to Mapper.DummyType if not used.

    TReaderResult4

    The fifth result set from data reader will be mapped an object or property of this type. Set to Mapper.DummyType if not used.

    TReaderResult5

    The sixth result set from data reader will be mapped an object or property of this type. Set to Mapper.DummyType if not used.

    TReaderResult6

    The seventh result set from data reader will be mapped an object or property of this type. Set to Mapper.DummyType if not used.

    TReaderResult7

    The eighth result set from data reader will be mapped an object or property of this type. Set to Mapper.DummyType if not used.

    TOutResult

    This must be either type TModel or Mapper.DummyType. If set to TModel the TModel properties will be mapped to cooresponding output parameters; if set to DummyType, the output parameters are ignored.

    | Improve this Doc View Source

    QueryResultsHandler<TShard, TModel>(TShard, String, Object, DbDataReader, DbParameterCollection, String, ILogger)

    Declaration
    public static TModel QueryResultsHandler<TShard, TModel>(TShard shardId, string sprocName, object notUsed, DbDataReader rdr, DbParameterCollection parameters, string connectionDescription, ILogger logger)
        where TShard : IComparable where TModel : class, new()
    Parameters
    Type Name Description
    TShard shardId
    System.String sprocName
    System.Object notUsed
    System.Data.Common.DbDataReader rdr
    System.Data.Common.DbParameterCollection parameters
    System.String connectionDescription
    Microsoft.Extensions.Logging.ILogger logger
    Returns
    Type Description
    TModel
    Type Parameters
    Name Description
    TShard
    TModel
    | Improve this Doc View Source

    QueryResultsHandler<TShard, TModel, TReaderResult, TOutParameters>(TShard, String, Object, DbDataReader, DbParameterCollection, String, ILogger)

    Declaration
    public static TModel QueryResultsHandler<TShard, TModel, TReaderResult, TOutParameters>(TShard shardId, string sprocName, object notUsed, DbDataReader rdr, DbParameterCollection parameters, string connectionDescription, ILogger logger)
        where TShard : IComparable where TModel : class, new()
        where TReaderResult : class, new()
        where TOutParameters : class, new()
    Parameters
    Type Name Description
    TShard shardId
    System.String sprocName
    System.Object notUsed
    System.Data.Common.DbDataReader rdr
    System.Data.Common.DbParameterCollection parameters
    System.String connectionDescription
    Microsoft.Extensions.Logging.ILogger logger
    Returns
    Type Description
    TModel
    Type Parameters
    Name Description
    TShard
    TModel
    TReaderResult
    TOutParameters
    | Improve this Doc View Source

    QueryResultsHandler<TShard, TModel, TReaderResult0, TReaderResult1, TOutParameters>(TShard, String, Object, DbDataReader, DbParameterCollection, String, ILogger)

    Declaration
    public static TModel QueryResultsHandler<TShard, TModel, TReaderResult0, TReaderResult1, TOutParameters>(TShard shardId, string sprocName, object notUsed, DbDataReader rdr, DbParameterCollection parameters, string connectionDescription, ILogger logger)
        where TShard : IComparable where TModel : class, new()
        where TReaderResult0 : class, new()
        where TReaderResult1 : class, new()
        where TOutParameters : class, new()
    Parameters
    Type Name Description
    TShard shardId
    System.String sprocName
    System.Object notUsed
    System.Data.Common.DbDataReader rdr
    System.Data.Common.DbParameterCollection parameters
    System.String connectionDescription
    Microsoft.Extensions.Logging.ILogger logger
    Returns
    Type Description
    TModel
    Type Parameters
    Name Description
    TShard
    TModel
    TReaderResult0
    TReaderResult1
    TOutParameters
    | Improve this Doc View Source

    QueryResultsHandler<TShard, TModel, TReaderResult0, TReaderResult1, TReaderResult2, TOutParameters>(TShard, String, DbDataReader, DbParameterCollection, String, ILogger)

    Declaration
    public static TModel QueryResultsHandler<TShard, TModel, TReaderResult0, TReaderResult1, TReaderResult2, TOutParameters>(TShard shardId, string sprocName, DbDataReader rdr, DbParameterCollection parameters, string connectionDescription, ILogger logger)
        where TShard : IComparable where TModel : class, new()
        where TReaderResult0 : class, new()
        where TReaderResult1 : class, new()
        where TReaderResult2 : class, new()
        where TOutParameters : class, new()
    Parameters
    Type Name Description
    TShard shardId
    System.String sprocName
    System.Data.Common.DbDataReader rdr
    System.Data.Common.DbParameterCollection parameters
    System.String connectionDescription
    Microsoft.Extensions.Logging.ILogger logger
    Returns
    Type Description
    TModel
    Type Parameters
    Name Description
    TShard
    TModel
    TReaderResult0
    TReaderResult1
    TReaderResult2
    TOutParameters
    | Improve this Doc View Source

    QueryResultsHandler<TShard, TModel, TReaderResult0, TReaderResult1, TReaderResult2, TReaderResult3, TOutParameters>(TShard, String, Object, DbDataReader, DbParameterCollection, String, ILogger)

    Declaration
    public static TModel QueryResultsHandler<TShard, TModel, TReaderResult0, TReaderResult1, TReaderResult2, TReaderResult3, TOutParameters>(TShard shardId, string sprocName, object notUsed, DbDataReader rdr, DbParameterCollection parameters, string connectionDescription, ILogger logger)
        where TShard : IComparable where TModel : class, new()
        where TReaderResult0 : class, new()
        where TReaderResult1 : class, new()
        where TReaderResult2 : class, new()
        where TReaderResult3 : class, new()
        where TOutParameters : class, new()
    Parameters
    Type Name Description
    TShard shardId
    System.String sprocName
    System.Object notUsed
    System.Data.Common.DbDataReader rdr
    System.Data.Common.DbParameterCollection parameters
    System.String connectionDescription
    Microsoft.Extensions.Logging.ILogger logger
    Returns
    Type Description
    TModel
    Type Parameters
    Name Description
    TShard
    TModel
    TReaderResult0
    TReaderResult1
    TReaderResult2
    TReaderResult3
    TOutParameters
    | Improve this Doc View Source

    QueryResultsHandler<TShard, TModel, TReaderResult0, TReaderResult1, TReaderResult2, TReaderResult3, TReaderResult4, TOutParameters>(TShard, String, Object, DbDataReader, DbParameterCollection, String, ILogger)

    Declaration
    public static TModel QueryResultsHandler<TShard, TModel, TReaderResult0, TReaderResult1, TReaderResult2, TReaderResult3, TReaderResult4, TOutParameters>(TShard shardId, string sprocName, object notUsed, DbDataReader rdr, DbParameterCollection parameters, string connectionDescription, ILogger logger)
        where TShard : IComparable where TModel : class, new()
        where TReaderResult0 : class, new()
        where TReaderResult1 : class, new()
        where TReaderResult2 : class, new()
        where TReaderResult3 : class, new()
        where TReaderResult4 : class, new()
        where TOutParameters : class, new()
    Parameters
    Type Name Description
    TShard shardId
    System.String sprocName
    System.Object notUsed
    System.Data.Common.DbDataReader rdr
    System.Data.Common.DbParameterCollection parameters
    System.String connectionDescription
    Microsoft.Extensions.Logging.ILogger logger
    Returns
    Type Description
    TModel
    Type Parameters
    Name Description
    TShard
    TModel
    TReaderResult0
    TReaderResult1
    TReaderResult2
    TReaderResult3
    TReaderResult4
    TOutParameters
    | Improve this Doc View Source

    QueryResultsHandler<TShard, TModel, TReaderResult0, TReaderResult1, TReaderResult2, TReaderResult3, TReaderResult4, TReaderResult5, TOutParameters>(TShard, String, Object, DbDataReader, DbParameterCollection, String, ILogger)

    Declaration
    public static TModel QueryResultsHandler<TShard, TModel, TReaderResult0, TReaderResult1, TReaderResult2, TReaderResult3, TReaderResult4, TReaderResult5, TOutParameters>(TShard shardId, string sprocName, object notUsed, DbDataReader rdr, DbParameterCollection parameters, string connectionDescription, ILogger logger)
        where TShard : IComparable where TModel : class, new()
        where TReaderResult0 : class, new()
        where TReaderResult1 : class, new()
        where TReaderResult2 : class, new()
        where TReaderResult3 : class, new()
        where TReaderResult4 : class, new()
        where TReaderResult5 : class, new()
        where TOutParameters : class, new()
    Parameters
    Type Name Description
    TShard shardId
    System.String sprocName
    System.Object notUsed
    System.Data.Common.DbDataReader rdr
    System.Data.Common.DbParameterCollection parameters
    System.String connectionDescription
    Microsoft.Extensions.Logging.ILogger logger
    Returns
    Type Description
    TModel
    Type Parameters
    Name Description
    TShard
    TModel
    TReaderResult0
    TReaderResult1
    TReaderResult2
    TReaderResult3
    TReaderResult4
    TReaderResult5
    TOutParameters
    | Improve this Doc View Source

    ReadOutParameters<TModel>(DbParameterCollection, ILogger)

    Creates a new object with property values based upon the provided output parameters which correspond to the MapTo attributes.

    Declaration
    public static TModel ReadOutParameters<TModel>(this DbParameterCollection parameters, ILogger logger)
        where TModel : class, new()
    Parameters
    Type Name Description
    System.Data.Common.DbParameterCollection parameters

    A parameter collection, generally belonging to a ADO.Net Command object after a database query.

    Microsoft.Extensions.Logging.ILogger logger

    The logger instance to write any processing or debug information to.

    Returns
    Type Description
    TModel

    An object of the specified type, with properties set to parameter values.

    Type Parameters
    Name Description
    TModel

    The type of the object. The "MapTo" attributes are used to read the Sql parameter collection values.

    | Improve this Doc View Source

    ReadOutParameters<TShard, TModel>(DbParameterCollection, TShard, ILogger)

    Creates a new object with property values based upon the provided output parameters which correspond to the MapTo attributes.

    Declaration
    public static TModel ReadOutParameters<TShard, TModel>(this DbParameterCollection parameters, TShard shardId, ILogger logger)
        where TShard : IComparable where TModel : class, new()
    Parameters
    Type Name Description
    System.Data.Common.DbParameterCollection parameters

    A parameter collection, generally belonging to a ADO.Net Command object after a database query.

    TShard shardId
    Microsoft.Extensions.Logging.ILogger logger

    The logger instance to write any processing or debug information to.

    Returns
    Type Description
    TModel

    An object of the specified type, with properties set to parameter values.

    Type Parameters
    Name Description
    TShard
    TModel

    The type of the object. The "MapTo" attributes are used to read the Sql parameter collection values.

    • Improve this Doc
    • View Source
    Back to top Generated by DocFX