Found a bug related to Linq for database
I recently write a web crawler which fetches data from website and store into the database. Since I have already had some same kind of data in the database, I have to use linq to detect whether or not the data fetched from website has already been in the database. Here comes the problem: every times the compiler runs into the Linq expression against the database table, it seems like it generates a new instance of the database, and not disposing it after leaving the brackets. Thus the query at some point would ran out of the memory. I rewrite my code so that it generates a list for all rows in the table at the beginning of the query, and updates the list after each submission, therefore my Linq expression will ran against the list instead of directly aginst the database table. This solves my problem, but I think the problem should be paid attention to by developers. Sincerely.