Using connection pool, what is the correct way?

saw the question of what today, but I'm not sure if I understand this well. In addition, using the same connection string causes them to “split” the connections (if available), right? So this is normal, if you have such a class, pass it as a link to each client in a multi-threaded application and just call its methods. In any case, will there be a short delay in the case when the first is connected?

 public int(string commandText)
    {
      SqlConnection con=new SqlConnection(SOME CONSTRING with pooling ON)
    ...

    }

    public string(string commandText)
    {
      SqlConnection con=new SqlConnection(the same CONSTRING with pooling ON)
    ...
    }
+3
source share
2 answers

, . , . , SqlConnection.

, using:

using (SqlConnection con = new SqlConnection(someConnectionString)
{
...
}

SqlConnection, . , SqlConnection, , .

- , . -, SqlConnection . , , . .

, , . , . , , .

, , .

+1

SQL, ; ODBC, JDBC, ADO.Net .. , . , , . .Net , : .NET Framework SQL Server

+1

Source: https://habr.com/ru/post/1754401/


All Articles