I'm implementing a method that calls a method that should return a IEnumerable<TEntidade>
. However, upon returning from this list the method that initiated the call simply terminates its execution without continuing to read the following code.
By debugging, I can access the value of the query variable within the scope of the List method.
Below is an example code. After the line var x = Listar();
the code finishes its execution.
public void DoSomething()
{
//Some code here
var x = Listar();
//Some code here
}
public IEnumerable<ModelEntities> Listar()
{
var _c = new SMSEntities();
var query = //query Linq
select new ModelEntities
{
//inicializando campos
};
return query;
}