I am using the sample database SofiaCarRental from Telerik.
I am trying to fetch all categories from the database and in the same query include the cars and rental rates.
I am aware this product is deprecated, however, we still need to maintain our application that is using this product.
Here’s my program
internal class Program
{
static void Main(string[] args)
{
var context = new FluentModel();
var query = context.Categories;
var fetchStrategy = new FetchStrategy();
fetchStrategy.LoadWith<Category>(category => category.Cars);
fetchStrategy.LoadWith<Category>(category => category.RentalRates); // <- This is not joined (look at the output SQL below)
query = query.LoadWith(fetchStrategy);
var queryString = query.ToString();
}
}
Here’s the value of the queryString
SELECT a.[CategoryID] AS COL1
,a.[CategoryID] AS COL2
,a.[CategoryName] AS COL3
,a.[ImageFileName] AS COL4
,b.[CarID] AS COL5
,b.[ABS] AS COL6
,b.[ASR] AS COL7
,b.[AirConditioner] AS COL8
,b.[Available] AS COL9
,b.[CarYear] AS COL10
,b.[CategoryID] AS COL11
,b.[CategoryID] AS COL12
,b.[DVDPlayer] AS COL13
,b.[ImageFileName] AS COL14
,b.[Latitude] AS COL15
,b.[Longitude] AS COL16
,b.[Make] AS COL17
,b.[Model] AS COL18
,b.[Mp3Player] AS COL19
,b.[Navigation] AS COL20
,b.[NumberOfRatings] AS COL21
,b.[Rating] AS COL22
,b.[TagNumber] AS COL23
FROM [Categories] a
LEFT JOIN [Cars] AS b ON (a.[CategoryID] = b.[CategoryID])
ORDER BY COL1
,COL11
I am expecting the output SQL to have a LEFT JOIN [RentalRates]
Is this confirmed as a bug?
Is this simply not possible?
Am I doing something wrong here?