System.Data.Common.DbDataAdapter.GetConnection1 C# (CSharp) Method

GetConnection1() private static method

private static GetConnection1 ( DbDataAdapter adapter ) : IDbConnection
adapter DbDataAdapter
return IDbConnection
        private static IDbConnection GetConnection1(DbDataAdapter adapter)
        {
            IDbCommand command = adapter._IDbDataAdapter.SelectCommand;
            if (null == command)
            {
                command = adapter._IDbDataAdapter.InsertCommand;
                if (null == command)
                {
                    command = adapter._IDbDataAdapter.UpdateCommand;
                    if (null == command)
                    {
                        command = adapter._IDbDataAdapter.DeleteCommand;
                    }
                }
            }
            IDbConnection connection = null;
            if (null != command)
            {
                connection = command.Connection;
            }
            if (null == connection)
            {
                throw ADP.UpdateConnectionRequired(StatementType.Batch, false);
            }
            return connection;
        }