Ejemplo n.º 1
0
 /// <summary>
 /// Instantiate Db with existing connection. The connection is only used for creating commands;
 /// it should be disposed by the caller when done.
 /// </summary>
 /// <param name="connection">The existing connection</param>
 /// <param name="config"></param>
 public Db(IDbConnection connection, DbConfig config)
 {
     _externalConnection = connection;
     Config = config ?? DbConfig.Default;
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Instantiate Db with connectionString and DbProviderName
 /// </summary>
 /// <param name="connectionString">The connection string</param>
 /// <param name="providerName">The ADO .Net Provider name. When not specified,
 /// the default value is used (see DefaultProviderName)</param>
 public Db(string connectionString, string providerName)
     : this(connectionString, DbConfig.FromProviderName(providerName))
 {
 }
Ejemplo n.º 3
0
        internal static IReadOnlyCollection <T> GetResultSet <T>(this IDataReader reader, DbConfig config, out bool moreResults)
        {
            var list = new List <T>();
            var map  = reader.GetSetterMap <T>(config);

            while (reader.Read())
            {
                list.Add(reader.MapTo(map));
            }
            moreResults = reader.NextResult();
            return(list);
        }