I'm using llbgenpro 2.0 with .net 2.0, sql2005, and adapter
I'm experimenting with the adventure works database.
the employee table is selfreferencing (employee - manager)
and references Contact table.
I want to prefetch one employee (a manager) and all of his subordinates.
I also want to prefetch his contact info and all contact info of his subordinates.
I tried this
IPrefetchPath2 prefetchPath = new PrefetchPath2((int)EntityType.EmployeeEntity);
prefetchPath.Add(EmployeeEntity.PrefetchPathContact);
prefetchPath.Add(EmployeeEntity.PrefetchPathSubOrdinateEmployees.SubPath.Add( EmployeeEntity.PrefetchPathContact));
but i get an exception:
System.ArgumentException was unhandled
Message="The PrefetchPathElement you to tried to add is already added to this PrefetchPath.\r\nParameter name: elementToAdd"
Source="SD.LLBLGen.Pro.ORMSupportClasses.NET20"
ParamName="elementToAdd"
StackTrace:
at SD.LLBLGen.Pro.ORMSupportClasses.PrefetchPath2.Add(IPrefetchPathElement2 elementToAdd, Int32 maxAmountOfItemsToReturn, IPredicateExpression additionalFilter, IRelationCollection additionalFilterRelations, ISortExpression additionalSorter, IEntityFactory2 entityFactoryToUse)
at SD.LLBLGen.Pro.ORMSupportClasses.PrefetchPath2.Add(IPrefetchPathElement2 elementToAdd)
at ConsoleApplication1.Program.Main(String[] args) in C:\ConsoleApplication1\Program.cs:line 27
at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()