Exemplo n.º 1
0
        public AdoNetProfilerDbConnection(string cs)
        {
            var c0   = ConfigurationManager.ConnectionStrings[cs];
            var fact = c0 == null ? "System.Data.SqlClient" : c0.ProviderName ?? "System.Data.SqlClient";
            var dbf  = DbProviderFactories.GetFactory(fact);
            var cn   = dbf.CreateConnection();

            cn.ConnectionString            = c0 == null ? cs : c0.ConnectionString;
            WrappedConnection              = cn;
            Profiler                       = AdoNetProfilerFactory.GetProfiler();
            WrappedConnection.StateChange += StateChangeHandler;
        }
Exemplo n.º 2
0
 /// <summary>
 /// Create a new instance of <see cref="AdoNetProfilerDbConnection" /> with recieving the instance of original <see cref="DbConnection" />.
 /// </summary>
 /// <param name="connection">The instance of original <see cref="DbConnection" />.</param>
 public AdoNetProfilerDbConnection(DbConnection connection)
     : this(connection, AdoNetProfilerFactory.GetProfiler())
 {
 }
Exemplo n.º 3
0
 /// <summary>
 /// Create a new instance of <see cref="AdoNetProfilerDbConnection" /> with recieving how to create the instance of original <see cref="DbConnection" />.
 /// </summary>
 /// <param name="connectionFactory">How to create the instance of original <see cref="DbConnection" />.</param>
 public AdoNetProfilerDbConnection(Func <DbConnection> connectionFactory)
     : this(connectionFactory, AdoNetProfilerFactory.GetProfiler())
 {
 }