Answer the question
In order to leave comments, you need to log in
What is the best way to connect to a database?
Hi all! I am making a small application for myself, in it I plan to access the database quite often, get / write users, logs, a bunch of other data, and now I don’t know how best to proceed, connect to the database every time I access it again, or do one general connection and open it during initialization and use it in all operations with the database?
Tell me, what are the pros and cons? Maybe there are some other options? This is the first application that I make with interaction with the database, I didn’t have time to fill the cones) now, when testing locally, there are not super many calls, but later, according to my assumptions, their number will increase significantly.
Thanks in advance!)
Answer the question
In order to leave comments, you need to log in
Your best bet is to use a data framework. Entity Framework or NHibernate, to choose from.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question