Reputation: 314
I am having issue understanding a problem I am encountering. Currently I am creating a ASP.net MVC website that pulls its information from a MSSQL Database. This seems to be working...somewhat.
If there is no INSERT statements aka information being added to the Database. Then everything runs smooth. Information loads and all is well.
If there is a INSERT query running inserting 50000 + records. Then my ASP.net application always has issues loading the information. Even when the INSERT query is initiated on a totally separate server.
I am just wondering if there is a certain method that should be used for pulling in information using asp.net. As if I just run a query from my persona machine through python. It also works just fine.
Is there special precaution to use while doing entity framework with MVC and querying the Database
I am using Entity Framework and calling a sotred procedure.
public List<VulnOverview_Result> getVulnOverview(string theDate, string theSite)
{
var vulnOverview = new List<VulnOverview_Result>();
if(theDate == null)
vulnOverview = entities.VulnOverview(null, theSite).ToList();
else
vulnOverview = entities.VulnOverview(Convert.ToDateTime(theDate), theSite).ToList();
return vulnOverview;
}
Upvotes: 0
Views: 62
Reputation: 416
You are probably suffering with locks. Turn on RCSI (Read Committed Snapshot Isolation) and this will solve the problem.
Use this instruction in your SQL Server:
ALTER DATABASE MyDB SET READ_COMMITTED_SNAPSHOT ON
GO
However, you will only be able to return the records already committed.
Upvotes: 1