Hey,
I just found a tiny bug and wondered if you had a remedy for it.
I am using SQL Server 2005, .Net 3.5 and latest LLBLGen release ( 2.5.8.228 ).
We have a Result table that has a FK UserId (to the User table of course) which allows nulls. User is a sub-type of Person due to the 1-to-1 relationship in the database. The UserId in the Result table will only have a value when the result has been validated.
So now when I try to execute the following code (which is a scaled down version of the real thing ):
ResultsetFields fields = new ResultsetFields(3);
fields[0] = ResultFields.Result;
fields[1] = UserFields.FirstName;
fields[2] = UserFields.LastName;
RelationCollection collection = new RelationCollection(ResultEntity.Relations.AnalyseEntityUsingAnalyseId);
collection.Add(ResultEntity.Relations.UserEntityUsingUserId, JoinHint.Left);
DataTable table = DynamicList.GetTypedListDataTable(fields, null,
new PredicateExpression(AnalyseFields.RequestId == new Guid("8F605773-4CEF-DC11-B310-0003FF1774A2")),
collection, false);
The following SQL is fired off against the database:
exec sp_executesql N'SELECT DISTINCT [preLink].[dbo].[Result].[Result], [LPA_L1].[FirstName], [LPA_L1].[LastName] FROM ((( [preLink].[dbo].[Analyse] INNER JOIN [preLink].[dbo].[Result] ON [preLink].[dbo].[Analyse].[AnalyseId]=[preLink].[dbo].[Result].[AnalyseId]) LEFT JOIN [preLink].[dbo].[User] [LPA_L2] ON [LPA_L2].[UserId]=[preLink].[dbo].[Result].[UserId]) LEFT JOIN [preLink].[dbo].[Person] [LPA_L1] ON [LPA_L1].[PersonId]=[LPA_L2].[UserId]) WHERE ( ( [preLink].[dbo].[Analyse].[RequestId] = @RequestId1) AND ( ( [LPA_L2].[UserId] IS NOT NULL)))',N'@RequestId1 uniqueidentifier',@RequestId1='8F605773-4CEF-DC11-B310-0003FF1774A2'
Which will only return records from the Results table where the UserId is not null. I need to be able to view ones that do not have a UserId as well.
Is there a way to turn off "AND ( ( [LPA_L2].[UserId] IS NOT NULL))"?
Thanks.