コード例 #1
0
        public static IConnectionProvider NewConnectionProvider(SessionElement settings)
        {
            IConnectionProvider connectionProvider;
            string providerClass = settings.ConnectionProvider;
            if (!string.IsNullOrEmpty(providerClass))
            {
                try
                {
                    connectionProvider = (IConnectionProvider)Activator.CreateInstance(Type.GetType(providerClass));
                }
                catch (Exception e)
                {

                    throw new Exception("Could not instantiate connection provider: " + providerClass, e);
                }
            }
            else if (!string.IsNullOrEmpty(settings.ConnectionString))
            {
                connectionProvider = new DriverConnectionProvider();
            }
            else
            {
                connectionProvider = new UserSuppliedConnectionProvider();
            }
            connectionProvider.Configure(settings);
            return connectionProvider;
        }
コード例 #2
0
        public static IConnectionProvider NewConnectionProvider(SessionElement settings)
        {
            IConnectionProvider connectionProvider;
            string providerClass = settings.ConnectionProvider;

            if (!string.IsNullOrEmpty(providerClass))
            {
                try
                {
                    connectionProvider = (IConnectionProvider)Activator.CreateInstance(Type.GetType(providerClass));
                }
                catch (Exception e)
                {
                    throw new Exception("Could not instantiate connection provider: " + providerClass, e);
                }
            }
            else if (!string.IsNullOrEmpty(settings.ConnectionString))
            {
                connectionProvider = new DriverConnectionProvider();
            }
            else
            {
                connectionProvider = new UserSuppliedConnectionProvider();
            }
            connectionProvider.Configure(settings);
            return(connectionProvider);
        }