Sie Ste

Sie Ste

  • NA
  • 196
  • 184k

data context object in web app 2010

Jun 24 2012 2:00 PM
I am asking this question since this is the first C#.net 2010 web form application that I am writing. In this application I am using linq to sql to connect to a sql server 2008 r2 database since that is what the rest of the web pages do in this application.

My question is on one particular web form page, I have been creating new datacontexts objects for each button that is used  on this web form page. All these data context objects refer to the same .dbml file.

Thus I am wondering if I should use only one data context object and put that creation of the data context object on top of the web page and give it a protected web form page access?

Can  you tell me and/or point me to a reference that will tell me what the best way is to handle this situation and show me how to accomplish this task in code?

Answers (1)