Esempio n. 1
0
    ///// <summary>
    ///// Reads the collection.
    ///// </summary>
    ///// <param name="reader">The reader.</param>
    ///// <returns>IEnumerable{`0}.</returns>
    // public IEnumerable<TEntity> ReadCollection(IDataReader reader)
    // {
    // return ReadCollection(reader, null);
    // }

    ///// <summary>
    ///// Reads the collection.
    ///// </summary>
    ///// <param name="reader">The reader.</param>
    ///// <param name="changeTracker">The change tracker.</param>
    ///// <returns>IEnumerable{`0}.</returns>
    // public IEnumerable<TEntity> ReadCollection(IDataReader reader, ObjectsChangeTracker changeTracker)
    // {
    // while (reader.Read())
    // {
    // TEntity result = MapUsingState(reader, reader);
    // if (changeTracker != null)
    // {
    // changeTracker.RegisterObject(result);
    // }
    // yield return result;
    // }
    // }

    /// <summary>
    ///   Gets the mapper impl.
    /// </summary>
    /// <param name="mappingKey">The mapping key.</param>
    /// <param name="mapperManager">The mapper manager.</param>
    /// <param name="skipFields">The skip fields.</param>
    /// <returns>ObjectsMapperBaseImpl.</returns>
    private static MapperBase GetMapperImpl(
        string mappingKey,
        Mapper mapperManager,
        IEnumerable <string> skipFields)
    {
        IMappingConfigurator config = new DbReaderMappingConfig(skipFields, mappingKey);

        if (mapperManager != null)
        {
            return(mapperManager.GetMapper(typeof(IDataReader), typeof(TEntity), config));
        }

        return(Mapper.Default.GetMapper(typeof(IDataReader), typeof(TEntity), config));
    }
        private static ObjectsMapperBaseImpl GetMapperImpl(
            string mappingKey,
            ObjectMapperManager mapperManager,
            IEnumerable <string> skipFields)
        {
            IMappingConfigurator config = new DbReaderMappingConfig(skipFields, mappingKey);

            if (mapperManager != null)
            {
                return(mapperManager.GetMapperImpl(
                           typeof(DbDataReader),
                           typeof(T),
                           config));
            }
            return(ObjectMapperManager.DefaultInstance.GetMapperImpl(
                       typeof(DbDataReader),
                       typeof(T),
                       config));
        }