I am new to databases and linq, so my problem might be considered trivial. I am currently running all my db requests in each class:
DataClassesDataContext db = new DataClassesDataContext()
Then I proceed to execute any linq request that I need in this method, and continue with the main application logic.
Now two interesting questions:
1) I believe that I saw how people exchange the use of db in "use". For instance:
using (DataClassesDataContext db = new DataClassesDataContext())
{
...
}
If this is correct, then that does not mean that my class can no longer use the db member variable, but rather, should these db requests be executed in every function call? Also, what exactly happens if I don't use “use” inside calls?
2) SQL Profiler , . , DataClassesDataContext ? , DataClassesDataContext , ?