Note that there are some explanatory texts on larger screens.

plurals
  1. POWhat is the best method for making database connection (static, abstract, per request, ...)?
    primarykey
    data
    text
    <p>I used lot of model for connecting to db, in my last project that i worked with C# &amp; entity framework, i created static class for db connecting but i had problem with opening and closing connection for that give me error when more than 10-15 requests come together, i solved it with changing method of connecting to db with i connect now per request and removed all static methods and classes.</p> <p>Now i want to know,</p> <p><strong>What is best model for making connection?</strong></p> <ol> <li>Should i close it after every query and open it before using or ...?</li> <li>A connection in static class is good model (that i don`t need to create it, every time)?</li> <li>Is there a good design pattern for this problem?</li> <li>All of it is for the same question What is the best method for making database connection (static, abstract, per request, ...)?</li> </ol> <p><strong>For example</strong> i working on a sms sender web panel, I should send 100K sms per second, these sms collect with others and make a package that every package have 1~20 sms then i need to send 5K~100K packages per one second and when i send a package i should do these steps:</p> <ol> <li>Update single sms to delivered or not delivered</li> <li>Update user balance if delivered decrease user balance in useraccounts table</li> <li>Update number of sms send count in user table</li> <li>Update number of sms send count in mobile number table</li> <li>Update number of sms send count in sender number table</li> <li>Update package for delivered and failed sms in package table</li> <li>Update package for how thread send this package in package table</li> <li>Update thread table for how many sms send it by this tread and how many failed</li> <li>Add account document for this transactions in AccountDocument table</li> </ol> <p>All steps and lot of other things like logs, user interface and monitoring widgets, that should doing and i need DB connection for doing every single of this transactions.</p> <p>Now, What is best model for connecting to DB? By human request or by thread request or by every single transaction..</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload