Is there any chance you put a Unique Constraint on the Manager's field that link to Employee? That way you could setup inheritance at LLBLGen Designer.
Thanks for the suggestion.
Once I have applied this constraint is there something other than click on the 'Construct target-per-entity Hierarchies' that I need to do to set-up the inheritence as clicking this made no difference? At the moment the change has just adjusted the relationship from 1:m to 1:1 which still leave me with the double SQL hit.
Please post the .Net code that you use to such fetch. Also post the Generated SQL for that fetches
IPredicateExpression idFilter = new PredicateExpression(EmployeeFields.EmployeeId == 1);
IPrefetchPath prefetch = new PrefetchPath((int)EntityType.EmployeeEntity);
prefetch.Add(EmployeeEntity.PrefetchPathManager);
EmployeeCollection entities = new EmployeeCollection();
entities.GetMulti(idFilter, prefetch);
SQL Hit 1:
exec sp_executesql N'SELECT [Onside_StructureOnly].[dbo].[Employee].[EmployeeID] AS [EmployeeId], [Onside_StructureOnly].[dbo].[Employee].[LabelName], [Onside_StructureOnly].[dbo].[Employee].[Title], [Onside_StructureOnly].[dbo].[Employee].[Firstname], [Onside_StructureOnly].[dbo].[Employee].[LastName],
[Onside_StructureOnly].[dbo].[Employee].[KnownAs], [Onside_StructureOnly].[dbo].[Employee].[OtherName], [Onside_StructureOnly].[dbo].[Employee].[PreviousSurname],
[Onside_StructureOnly].[dbo].[Employee].[Salutation], [Onside_StructureOnly].[dbo].[Employee].[EmployeeFullName], [Onside_StructureOnly].[dbo].[Employee].[Suffix],
FROM [Onside_StructureOnly].[dbo].[Employee] WHERE ( ( [Onside_StructureOnly].[dbo].[Employee].[EmployeeID] = @EmployeeId1))',N'@EmployeeId1 int',@EmployeeId1=1
SQL Hit 2:
exec sp_executesql N'SELECT [Onside_StructureOnly].[dbo].[Manager].[ManagerID] AS [ManagerId], [Onside_StructureOnly].[dbo].[Manager].[EmployeeID] AS [EmployeeId], [Onside_StructureOnly].[dbo].[Manager].[DateCreated], [Onside_StructureOnly].[dbo].[Manager].[CreatorID] AS [CreatorId], [Onside_StructureOnly].[dbo].[Manager].[DateUpdated], [Onside_StructureOnly].[dbo].[Manager].[UpdatorID] AS [UpdatorId], [Onside_StructureOnly].[dbo].[Manager].[Notes] FROM [Onside_StructureOnly].[dbo].[Manager] WHERE ( ( ( ( [Onside_StructureOnly].[dbo].[Manager].[EmployeeID] = @EmployeeId1))))',N'@EmployeeId1 int',@EmployeeId1=1
And last but not least, LLBLGen build and runtime library version?
LLBLGen Build: 2.6 Final
Runtime library version: 2.6.8.911