/// <summary>
        /// create a clone.
        /// </summary>
        /// <returns>The <see cref="ProfiledDbConnection"/>.</returns>
        public ProfiledDbConnection Clone()
        {
            var tail = InnerConnection as ICloneable;

            if (tail == null)
            {
                throw new NotSupportedException("Underlying " + InnerConnection.GetType().Name + " is not cloneable");
            }
            return(new ProfiledDbConnection((DbConnection)tail.Clone(), DbProfiler));
        }
Esempio n. 2
0
        /// <summary>
        /// Gets a client of the given type
        /// </summary>
        public object GetClientFromType(Type type)
        {
            var m = InnerConnection.GetType()
                    .GetMethods(BindingFlags.Public | BindingFlags.Instance)
                    .Where(m => m.Name.Equals("GetClient")).FirstOrDefault();

            return(m?
                   .MakeGenericMethod(type)
                   .Invoke(InnerConnection, null));
        }
Esempio n. 3
0
        public ProfiledDbConnection Clone()
        {
            var tail = InnerConnection as ICloneable;

            if (tail == null)
            {
                throw new NotSupportedException(string.Format("Underlying {0} is not cloneable", InnerConnection.GetType().Name));
            }
            return(new ProfiledDbConnection((DbConnection)tail.Clone(), _profiler));
        }