Quantcast
Channel: Microsoft Dynamics SL Forum - Recent Threads
Viewing all articles
Browse latest Browse all 2378

Dynamics 2015 - WebApp

$
0
0

We are developing a custom WebApp and we are getting a error with Entity Framwork.

We are have a code-first Entity Framework 6.1.3 context that throws an SQL timeout exception when directly querying a certain table using SQL Server 2014. 

Query code: 

var q = _appContext.PJLABDET 

.Where(x => x.user1.Trim() == ServiceCallID.Trim() && x.user3 == LineID); 

returnObject = q.SingleOrDefault(); 

The query works and returns instantly when querying a copy of the same database on SQL Server 2012. Also, extracting the raw SQL query from the LINQ and executing manually also returns instantly. 

The query works on 2014 when I precede it with an explicit open command: 

_appContext.Database.Connection.Open(); 

var q = _appContext.PJLABDET 

.Where(x => x.user1.Trim() == ServiceCallID.Trim() && x.user3 == LineID); 

returnObject = q.SingleOrDefault(); 

This leads me to believe that for some reason, EF6 isn't opening connections to our SQL 2014 server properly. Also, this only happens with this one table, any other queries seem to be working just fine. 

Any ideas? We're trying to avoid rebuilding our SQL 2014 server.


Viewing all articles
Browse latest Browse all 2378

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>