Hello
I have a question about “Polymorphic Prefetch Paths,” I am using adapter setup, and I have read the little entry on the manual about this.
Here is my database lay out
PointIndex -> (key)PointType -> (key)Protocol -> (key)ProtocolSettingGroupInfo.
I am trying from a record from PointIndex to read a text entry related to that record on ProtocolSettingGroupInfo.
I am using the following code:
EntityCollection pointIndexCollection = new EntityCollection(new PointIndexEntityFactory());
IPrefetchPath2 prefetchPath = new PrefetchPath2((int)EntityType.PointIndexEntity);
prefetchPath.Add(ProtocolEntity.PrefetchPathProtocolSettingGroupInfo);
RelationPredicateBucket bucket = new RelationPredicateBucket();
IPredicateExpression filter = new PredicateExpression();
filter.Add(PredicateFactory.CompareValue(PointIndexFieldIndex.PointIndexID,ComparisonOperator.Equal,0));
bucket.PredicateExpression.Add(filter);
int returnRecords = 0;
using (DataAccessAdapter dataAccessAdapter = new DataAccessAdapter(ConnectionString.GetZoneServer()))
{
try
{
dataAccessAdapter.FetchEntityCollection(pointIndexCollection, bucket, prefetchPath);
returnRecords = pointIndexCollection.Count;
}
catch(Exception e)
{
Console.WriteLine(e.ToString());
}
}
And I get the following error when trying to run it:
System.ApplicationException: The prefetch path element at index 0 in the passed in prefetch path for root entity type 12 is meant for root entity type 23 which isn't a subtype of 12 at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase.FetchParameterisedPrefetchPath(IEntityCollection2 rootEntities, Int64 maxNumberOfItemsToReturn, IPrefetchPath2 prefetchPath) at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase.FetchPrefetchPath(IEntityCollection2 rootEntities, IRelationPredicateBucket filterBucket, Int64 max NumberOfItemsToReturn, ISortExpression sortClauses, IPrefetchPath2 prefetchPath) at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase.FetchEntityCollection(IEntityCollection2 collectionToFill, IRelationPredicateBucket filterBucket, IPrefetchPath2 prefetchPath) at InformationIntellect.DVM.ZoneServer.CO.Debug.TerminalTest.Main(String[] args) in C:\InformationIntellect\DVM\ZoneServer\CO.Debug\TerminalTest.cs:line 52
Could someone please point me in the right direction?
Thank you,
BrunoV