コード例 #1
0
ファイル: Connector.cs プロジェクト: keepingcode/framework
        public static DbConnection Connect(string configuration)
        {
            string connectionString   = null;
            string connectionProvider = null;

            ExtractConnectionStringInfo(configuration, out connectionProvider, out connectionString);

            var factory = DataExtensions.GetFactory(connectionProvider);

            OptimizeConnectionString(factory, ref connectionString);

            var connection = factory.CreateConnection();

            connection.ConnectionString = connectionString;
            connection.Open();

            OptimizeConnection(connection);

            return(connection);
        }