Linq-to-SQL Timeout
I’ve been receiving an error on one of my pages that the linq query has timed out as it is taking too long. It makes the page unusable.
I’ve been receiving an error on one of my pages that the linq query has timed out as it is taking too long. It makes the page unusable.
I have this code:
I’m trying to use LINQ to SQL to select a few specific columns from a table and return the result as a strongly typed list of objects.
I need my linq to sql datacontext to be available across my business/data layer for all my repository objects to access. However since this is a web app, I want to create and destroy it per request. I’m wondering if having a singleton class that can lazily create and attach the datacontext to current HttpContext would work. My question is: would the datacontext get disposed automatically when the request ends? Below is the code for what I’m thinking. Would this accomplish my purpose: have a thread-safe datacontext instance that is lazily available and is automatically disposed when the request ends?
Error Message: Row not found or changed. Stack Trace: at System.Data.Linq.ChangeProcessor.SubmitChanges(ConflictMode failureMode) at System.Data.Linq.DataContext.SubmitChanges(ConflictMode failureMode) This occurs seemingly randomly. I get emailed these errors, and the URL reported always seems to work for me and should be functioning for everyone else as well. I can fix this error by: Going to my dbml layout Selecting … Read more
I have a List<DateTime> dates;
I am trying to figure out how to tackle this problem. I have to insert some data into 2 tables lets call them Table A and Table B.
I’m trying to make an educated decision about what ORM to use for a number of legacy applications I’m responsible for porting to MVC 2. The ORMs I’ve looked at are LINQ to SQL, LINQ to Entities and nHibernate. L2S seemed to be the easiest, but I’ve found numerous articles and blog entries stating that Microsoft would no longer be updating it after .NET 3.5. With that in mind, I’ve been working with Entities a bit, but have found that it is cumbersome and overcomplicated for the small applications I’m working with (same with nHibernate). I recently purchased “Pro ASP.NET MVC 2 Framework” by Steven Sanderson, in which he chose to use LINQ to SQL as his ORM, at one point stating:
In order to fully use LinqToSql in an ASP.net 3.5 application, it is necessary to create DataContext classes (which is usually done using the designer in VS 2008). From the UI perspective, the DataContext is a design of the sections of your database that you would like to expose to through LinqToSql and is integral in setting up the ORM features of LinqToSql.
I have ASP.NET application which is connected with SQL server using LINQ to SQL. Where as i have a static class , certainly it would work on application level. Where as I have created static object of DataContext in this static class.
I have not created any data context object in application except this. Where as i am using this static data context object for each data base manipulation.