I have a simple LINQ-to-EF query for which I stopped working for some reason, through which my This means that as soon as the execution is executed, the control control is not returned to the next line. I can not understand why this could happen. If I run the same query in LinqPad using LINQ-to-SQL, then it works fine. Here's the query:
Model. Currency curr = _db.Currencies.SingleOrDefault (x => x.ISO == P.Item [i] .CurType);
Where _db
is my entity container reference and the value is "USD" in p.Items [i] .curType
What can be the problem?
TIA - E!
PS I'm running on Visual Studio 2013 with MVC5
* Update I *
as per the suggestions given below , I have both "connection timeout = 10" in my connection string (in Web.config) and a command timeout (* .Context.cs) in this way:
public partial class entities: DbContext {Public institutions (): base ("name = entities") {((IObjectContextAdapter this). Object Konnecte Comma timeout = 10; }
The query is still hanging (never to throw an exception at all) and I had a database on the query when the query was hung I could see that SQL Released (more or less):
Select from currencies *
That should be returned immediately because only 100 small records in that table The connection on which the query is issued is asleep and is waiting for the command, and There is no block in the database; 0 CPU / io empty in question
What else should I look like?
There was a problem with the help of the iPod on the C # channel of Firodies: I should have seen an exception bubble But I was not there. They have recommended that I log in to my database output like this:
_db.Database.log = s = & gt; System.Diagnostics.Debug.WriteLine (s);
This error was detected:
The first chance of type 'System.NotSupportedException' is to close the connection on EntityFramework.dll on 3/17/2015 3:56:43 pm-07: 00
Out of which he deemed it cleverly in reference to p.Items [i]. The cruel type
was messing up the lynake. While analyzing the expression while expressing by [i] (ii) [instructor] compiler [instructim] the tree [e] will be realized [respectively] there is a method called get_Items (Int32) [suggestive] But there is no clue how this translates into SQL [Supreme], because it throws NotSupportedException
which is proven by the fact that if I I rewrite the code by the way:
var item = p.Items [i]; Var curr = _db.Currencies.SingleOrDefault (x = & gt; x.ISO == item.CurType);
This works!
No comments:
Post a Comment