Database cache that I'm not aware of?

Posted by Martin on Stack Overflow See other posts from Stack Overflow or by Martin
Published on 2010-06-11T12:45:04Z Indexed on 2010/06/11 16:32 UTC
Read the original article Hit count: 217

I'm using asp.net mvc, linq2sql, iis7 and sqlserver express 2008.

I get these intermittent server errors, primary key conflicts on insertion. I'm using a different setup on my development computer so I can't debug. After a while they go away. Restarting iis helps. I'm getting the feeling there is cache somewhere that I'm not aware of. Can somebody help me sort out these errors?

Cannot insert duplicate key row in object 'dbo.EnquiryType' with unique index 'IX_EnquiryType'.

Edits regarding Venemos answer

Is it possible that another application is also accessing the same database simultaneously? Yes there is, but not this particular table and no inserts or updates. There is one other table with which I experience the same problem but it has to do with a different part of the model.

How often an in what context do you create a new DataContext instance? Only once, using the singleton pattern.

Are the primary keys generated by the database or by the application? Database.

Which version of ASP.NET MVC and which version of .NET are you using? RC2 and 3.5.

© Stack Overflow or respective owner

Related posts about asp.net-mvc

Related posts about linq-to-sql