I have main select which looks like this:
protected IQueryable<Answers> GetActualAnswers<TAns>(DateTime? start, DateTime? end, long? statusId) where TAns: AnswersBase
{
_contex.Set<TAns>.Where(x => x.Type == VoteType.Good)
.Select(vv => new Answers
{
CreatedAt = vv.CreatedAt,
StatusId = vv.StatusId,
Type = vv.Type ,
AnswerInGuideStatusId = vv.AnswerInGuideStatusId
}
}
I'm using this method in two simple queries:
var result1 = GetActualAnswers<JournalAnswers>(start, end, statusId)
.Select(j => new UnitedAnswers
{
Question = j.Question,
}
var result2 = GetActualAnswers<BoAnswers>(start, end, statusId)
.Select(b => new UnitedAnswers
{
Prospects = b.Prospects ,
}
var mainResult = result1.Concat(result2);
I get errors:
Sql = Sql = '((System.Data.Entity.Infrastructure.DbQuery<UnitedAnswers>)result1).Sql' threw an exception of type 'System.NotSupportedException'
Sql = Sql = '((System.Data.Entity.Infrastructure.DbQuery<UnitedAnswers>)result2).Sql' threw an exception of type 'System.NotSupportedException'
Sql = Sql = '((System.Data.Entity.Infrastructure.DbQuery<UnitedAnswers>)mainResult).Sql' threw an exception of type 'System.NotSupportedException'
Is it possible to use several Selects? May be someone can give advice with this query?