コード例 #1
0
        public static Driver Create(MySqlConnectionStringBuilder settings)
        {
            Driver d = null;

#if !CF
            try
            {
                if (MySqlTrace.QueryAnalysisEnabled || settings.Logging || settings.UseUsageAdvisor)
                {
                    d = new TracingDriver(settings);
                }
            }
            catch (TypeInitializationException ex)
            {
                if (!(ex.InnerException is SecurityException))
                {
                    throw ex;
                }
                //Only rethrow if InnerException is not a SecurityException. If it is a SecurityException then
                //we couldn't initialize MySqlTrace because we don't have unmanaged code permissions.
            }
#endif
            if (d == null)
            {
                d = new Driver(settings);
            }

            d.Open();
            return(d);
        }
コード例 #2
0
        public static Driver Create(MySqlConnectionStringBuilder settings)
        {
            Driver d = null;
            #if !CF
            try
            {
                if (MySqlTrace.QueryAnalysisEnabled || settings.Logging || settings.UseUsageAdvisor)
                    d = new TracingDriver(settings);
            }
            catch (TypeInitializationException ex)
            {
                if (!(ex.InnerException is SecurityException))
                    throw ex;
                //Only rethrow if InnerException is not a SecurityException. If it is a SecurityException then
                //we couldn't initialize MySqlTrace because we don't have unmanaged code permissions.
            }
            #endif
            if (d == null)
                d = new Driver(settings);

            d.Open();
            return d;
        }