Skip to content

Select navigation property produces SELECT NULL #56

@kccarter76

Description

@kccarter76

Describe the bug
when a select(x => x.{Navigation Property}) the SQL generated is invalid

To Reproduce
Steps to reproduce the behavior:
on release 4.2.0 execute the following code

Expression select = person
                .Renters
                .Where((Renter) =>
                    DateTime.Today.Between(Renter.StartDate, Renter.EndDate.GetValueOrDefault(DateTime.Today.AddDays(1))))
                .Include(x => x.Unit)
                .Select(x => x.Unit)
                .Expression;

Expected behavior
the SELECT SQL generated should have been:

SELECT [T1].[ID], [T1].[Bedrooms] AS [NumberOfBedrooms], [T1].[StatusID], [T1].[RealEstatePropertyID]
FROM [dbo].[Renter] AS [T2]
	INNER JOIN [dbo].[Unit] AS [T1]
		ON ([T1].[ID] = [T2].[UnitID])
WHERE (([T2].[PersonID] = @personid_1) AND @dt_value_2 BETWEEN [T2].[StartDate] AND COALESCE([T2].[EndDate], @dt_value_3))

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions