Hi, I use LLBLGen 5.11.0, Postgres version: 15.5 and .NET 8.0. I tried to create SQL query and use "union" operator:
var q1 = from eec in linqMetaData.EmployeeTable
select new { eec.Number, Date = eec.StartDate };
var q2 = from eec in linqMetaData.EmployeeTable
join ssi in linqMetaData.InfoTable on eec.InfoId equals ssi.InfoId
select new { eec.Number, Date = ssi.StartDate };
var q3 = q1.Union(q2);
var result = q3.ToList();
When I want to fetch result, I get an error:
System.InvalidOperationException: 'BUG: Converting a unioned query to QueryParameters failed as the query is of type 'System.Linq.IQueryable`1[[<>f__AnonymousType42`2[[System.String, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.DateTime, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], Epos.Payroll.Api, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]]' and not of type QueryExpression'
Stack trace:
at SD.LLBLGen.Pro.LinqSupportClasses.ExpressionClasses.QueryExpression.AppendUnionedQueriesAsQueryParameters(QueryParameters toAppendTo, Func`2 preprocessorFunc)
at SD.LLBLGen.Pro.LinqSupportClasses.ExpressionClasses.QueryExpression.GetQueryParameters(SetAlias aliasSuggestion, Func`2 unionedQueriesPreprocessorFunc)
at SD.LLBLGen.Pro.LinqSupportClasses.LLBLGenProProvider2.ExecuteValueListProjection(QueryExpression toExecute)
at SD.LLBLGen.Pro.LinqSupportClasses.LLBLGenProProviderBase.ExecuteExpression(Expression handledExpression, Type typeForPostProcessing)
at SD.LLBLGen.Pro.LinqSupportClasses.LLBLGenProProviderBase.PerformExecute(Expression expression, Type resultType)
at SD.LLBLGen.Pro.LinqSupportClasses.LLBLGenProProviderBase.System.Linq.IQueryProvider.Execute(Expression expression)
at SD.LLBLGen.Pro.LinqSupportClasses.LLBLGenProQuery`1.Execute()
at SD.LLBLGen.Pro.LinqSupportClasses.LLBLGenProQuery`1.System.Collections.Generic.IEnumerable<T>.GetEnumerator()
at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
My question is if in this case, should I create a view in SQL or I can resolve this issue in another way.