3.1.11.706 Final (SD.LLBLGen.Pro.DQE.SqlServer.NET20.dll)
3.1.12.0222 (SD.LLBLGen.Pro.ORMSupportClasses.NET20.dll
3.1.12.216 (SD.LLBLGen.Pro.LinqSupportClasses.NET35)
DotNet 4.0 vs2010 project
Adapter template
When LLB creates the EXISTS (SELECT ...) for .Any() it uses what is apparently a random field name. It will pick from all the fields in the entity which means any .IncludeFields in the parent sql gets ignored. Here is some SQL that crashes as 'RepealNotes' doesn't exist in the database revision being used:
exec sp_executesql N'SELECT [LPA_L1].[RegID], [LPA_L1].[LanguageCode], [LPA_L1].[RegTitle], [LPA_L1].[RegSummary], [LPA_L1].[ConsolidatedHyperlink] FROM [enhesaSQL_20120305_1].[dbo].[RegulationText] [LPA_L1] WHERE ( ( ( ( ( ( ( ( NOT EXISTS (SELECT [LPLA_2].[RepealNote] FROM [enhesaSQL_20120305_1].[dbo].[RegulationText] [LPLA_2] WHERE ( ( ( [LPLA_2].[LanguageCode] = @p1) AND ( [LPLA_2].[RegID] = [LPA_L1].[RegID])))) AND ( [LPA_L1].[LanguageCode] = @p2)) OR ( [LPA_L1].[LanguageCode] = @p3)) AND ( [LPA_L1].[RegID] = @p4)))))))',N'@p1 varchar(6),@p2 varchar(6),@p3 varchar(6),@p4 int',@p1='en',@p2='en',@p3='en',@p4=286
The '[LPLA_2].[RepealNote]' could just as easily be NULL and would avoid the problem. is there a workaround for this? Note that the top level sql has only included relevant fields.