LINQ in Action roller

DataContext lifespan and DataContext flushing

Hello. I have been experimenting with Linq to SQL and have a number of questions: Consider the following code block (user class represents a user of the application): /// Use this to retrieve the user instance when first logged on. public User GetLoggedOnUser(int loggedOnUserId) { MyDataContext dc = new MyDataContext(); User result = dc.Users.Single(u => u.UserId == loggedOnUserId); return result; } ///Elsewhere in the life of the application ///Do something with the user, and save the changes. Read More...
Published Wednesday, June 20, 2007 2:35 PM by MSDN Forums: LINQ Project General
Anonymous comments are disabled

Featured Item

This Blog

Sponsoring

Syndication