Click here to Skip to main content
15,916,463 members
Home / Discussions / C#
   

C#

 
AnswerRe: Error loading XML data Pin
Garry J Evans1-Apr-10 6:19
Garry J Evans1-Apr-10 6:19 
GeneralRe: Error loading XML data Pin
billy_iii6-Apr-10 1:43
billy_iii6-Apr-10 1:43 
GeneralRe: Error loading XML data Pin
Garry J Evans6-Apr-10 2:54
Garry J Evans6-Apr-10 2:54 
QuestionDo I need to Dispose LINQ To SQL Data Context ? Pin
Nadia Monalisa1-Apr-10 1:35
Nadia Monalisa1-Apr-10 1:35 
AnswerRe: Do I need to Dispose LINQ To SQL Data Context ? Pin
R. Giskard Reventlov1-Apr-10 1:41
R. Giskard Reventlov1-Apr-10 1:41 
GeneralRe: Do I need to Dispose LINQ To SQL Data Context ? Pin
Nadia Monalisa1-Apr-10 7:22
Nadia Monalisa1-Apr-10 7:22 
AnswerRe: Do I need to Dispose LINQ To SQL Data Context ? Pin
Not Active1-Apr-10 1:46
mentorNot Active1-Apr-10 1:46 
GeneralRe: Do I need to Dispose LINQ To SQL Data Context ? [modified] Pin
Nadia Monalisa1-Apr-10 7:14
Nadia Monalisa1-Apr-10 7:14 
Hi Mark, thank you very much for your reply. I realized that I need to know a pattern using DataContext. I have following code in my ASP.NET page. I am wondering If it is more efficient to place the line SpDBDataContext myDbContext = new SpDBDataContext();
globally and override the Page's Dispose method and call the myDbContext.Dispose() method inside that Disposer !!

protected void _linqDataSourceProductsFirst_Selecting(object sender, LinqDataSourceSelectEventArgs e)
     {
           using (SpDBDataContext myDbContext = new SpDBDataContext())
           {
               var productResults = myDbContext.products.Where(x => emran.publish).OrderBy(x => x.isFeatured);
              e.Result = productResults;
           }
    }



About using layered system, actually I know layered system as I used to have Data Access Layer whole life until I learned LINQ to SQL. I always hated data access layer because, if I change a table schema in my SQL server database, I had to manually find out my data acccess layer which code needs change as the application will still compile with a wrong SQL Schema. So, when I learned LINQ to SQL, I just felt great and new I feel free to change any table column in SQL server and then, drag and drop the new Table to the ORM page and then, I get error in compile time where the usage needs changing. So, to my point of view, the ORM page (.dbml page) is working as a data access layer where I place my LINQ query directly within my code. It is just for maintainance peace.
modified on Thursday, April 1, 2010 1:26 PM

GeneralRe: Do I need to Dispose LINQ To SQL Data Context ? Pin
Not Active1-Apr-10 7:34
mentorNot Active1-Apr-10 7:34 
GeneralRe: Do I need to Dispose LINQ To SQL Data Context ? Pin
Nadia Monalisa1-Apr-10 8:00
Nadia Monalisa1-Apr-10 8:00 
GeneralRe: Do I need to Dispose LINQ To SQL Data Context ? Pin
Not Active1-Apr-10 8:24
mentorNot Active1-Apr-10 8:24 
QuestionSelecting everything with CTRL+A Pin
teknolog1231-Apr-10 0:55
teknolog1231-Apr-10 0:55 
AnswerRe: Selecting everything with CTRL+A Pin
Mohammad Elsheimy1-Apr-10 1:14
Mohammad Elsheimy1-Apr-10 1:14 
AnswerRe: Selecting everything with CTRL+A Pin
Khaniya1-Apr-10 1:32
professionalKhaniya1-Apr-10 1:32 
GeneralRe: Selecting everything with CTRL+A Pin
teknolog1231-Apr-10 1:57
teknolog1231-Apr-10 1:57 
AnswerRe: Selecting everything with CTRL+A Pin
teknolog1231-Apr-10 1:52
teknolog1231-Apr-10 1:52 
GeneralRe: Selecting everything with CTRL+A Pin
Khaniya1-Apr-10 2:52
professionalKhaniya1-Apr-10 2:52 
QuestionDifferent number of overloaded constructors for same class in different computers [modified] Pin
free young1-Apr-10 0:31
free young1-Apr-10 0:31 
AnswerRe: Different number of overloaded constructors for same class in different computers Pin
Tej Aj1-Apr-10 1:36
Tej Aj1-Apr-10 1:36 
GeneralRe: Different number of overloaded constructors for same class in different computers Pin
free young1-Apr-10 18:21
free young1-Apr-10 18:21 
AnswerRe: Different number of overloaded constructors for same class in different computers Pin
PIEBALDconsult1-Apr-10 3:44
mvePIEBALDconsult1-Apr-10 3:44 
GeneralRe: Different number of overloaded constructors for same class in different computers Pin
free young1-Apr-10 18:25
free young1-Apr-10 18:25 
QuestionSimple Passing of Values Pin
Steve-Co31-Mar-10 23:56
Steve-Co31-Mar-10 23:56 
AnswerRe: Simple Passing of Values Pin
Khaniya1-Apr-10 0:05
professionalKhaniya1-Apr-10 0:05 
GeneralRe: Simple Passing of Values Pin
dan!sh 1-Apr-10 0:13
professional dan!sh 1-Apr-10 0:13 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.