Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kanban.ListWorkloadsByUser is broken after upgrading to NetCore 1.1 #21

Closed
fcatae opened this issue Feb 6, 2017 · 1 comment
Closed

Comments

@fcatae
Copy link
Owner

fcatae commented Feb 6, 2017

Exception:

Microsoft.EntityFrameworkCore.Query.Internal.SqlServerQueryCompilationContextFactory[1]
      An exception occurred in the database while iterating the results of a query.
      System.InvalidOperationException: Sequence contains no elements
         at System.Linq.Enumerable.First[TSource](IEnumerable`1 source)
         at lambda_method(Closure , ValueBuffer )
         at System.Linq.Enumerable.<JoinIterator>d__80`4.MoveNext()
         at System.Linq.Enumerable.<JoinIterator>d__80`4.MoveNext()
         at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
         at Microsoft.EntityFrameworkCore.Query.Internal.LinqOperatorProvider.ExceptionInterceptor`1.EnumeratorExceptionInterceptor.MoveNext()
System.InvalidOperationException: Sequence contains no elements
   at System.Linq.Enumerable.First[TSource](IEnumerable`1 source)
   at lambda_method(Closure , ValueBuffer )
   at System.Linq.Enumerable.<JoinIterator>d__80`4.MoveNext()
   at System.Linq.Enumerable.<JoinIterator>d__80`4.MoveNext()
   at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
   at Microsoft.EntityFrameworkCore.Query.Internal.LinqOperatorProvider.ExceptionInterceptor`1.EnumeratorExceptionInterceptor.MoveNext()
@fcatae
Copy link
Owner Author

fcatae commented Feb 6, 2017

The corresponding command with error:

from wb in _context.WorkloadBacklogs 
join wbu in _context.WorkloadBacklogUsers on wb.WBID equals wbu.WorkloadBacklogWBID
join uk in _context.Users on wbu.User.UniqueName equals uk.UniqueName
where uk.UniqueName.Equals(uniqueName)
orderby wb.WBTitle
select new WorkloadsByUserViewModel
{
}

The problem seems to be related to the join of WorkloadBacklogs and WorkloadBacklogUsers tables. The initial join uses a complicated relation of

wb.WBUsers.Where(u => u.User.UniqueName == uniqueName).First().WBUserID equals wbu.WBUserID

I think it should be something like this:

on wb.WBID equals wbu.WorkloadBacklogWBID

fcatae pushed a commit that referenced this issue Feb 6, 2017
@fcatae fcatae closed this as completed in d50e012 Feb 6, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant