A
A
Alec Onim2015-12-31 01:08:39
SQL
Alec Onim, 2015-12-31 01:08:39

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

2 answer(s)
A
Anton Papin, 2016-01-07
@Caitiff_One

Your best bet is to use a data framework. Entity Framework or NHibernate, to choose from.

P
Peter, 2015-12-31
@petermzg

One connection and use in all operations. Moreover, you say that the number of operations will increase.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question