Raphael Gomes wrote:
> Greetings,
>
> I've been using linq to sql in a web project that uses tables with
> about 1 million records each. Recently, we found the server freezing
> and we're isolating the problem in the ms sql server, which is hogging
> up resources (memory and processor).
>
> I did a quick readying about the subject, and couln't find where do I
> set up linq to free the used resources. Also, regarding the queries,
> how do I ensure that linq is being efficient?
>
> Thanks in advance, You should look up Linq-to-SQL and lazy loading as opposed to immediate
loading.
You can use a tool like Link-to-SQL Debug Visualizer that allows you to
look at the formulated inline SQL a Ling-To-SQL query creates before it
is executed.
Are you using the USING statement to open the database connection, which
you can do with Linq-to-SQL.
Also, you can look-up Linq DataContext and Dispose.