ADF1969 wrote:
I have two assemblies:
LgpBase.Data2
LgpClient.Data2
The LgpBase assembly contains LGP objects that are "base classes" for applications (I have modified all the templates so they inherit from a base EntityType in that assembly).
The LgpClient assembly contains client-specific entities and collections and code.
So far, I have not had too many issues with keeping them straight but now I have an issue.
I want to be able to create a "PrefetchPathElement" that crosses the two assemblies.
In the past, the various "factory" classes have always taken an IEntityField as their param which has been easy to solve (I have a global EntityFieldFactory routine that will find any EntityField type in any loaded assembly), but the PrefetchPathElement uses an Integer to refer to the EntityField, not the EntityField itself.
My questions are:
1) Is there a reason it uses an integer to reference the field instead of the Field itself?
EntityType enum value, not the entityfield enum. It uses the entitytype value to determine if a prefetchpath element is meant for a given parent.
This is a number, as the code is in the ormsupportclasses and that assembly doesn't have a reference to the generated code.
2) Is there a way I can accomplish the same results as the "PrefetchPathElement" without using a PrefetchPathElement?
No, you have to produce a prefetchpathelement, but how you do that is up to you of course. You can simply gather the information somewhere in a factory and produce such an element. It's just a class, so all the prefetchpath needs is an instance of a prefetchpathelement.
3) Is there a way I can create a PrefetchPathElement that can pre-fetch results from an entity in a different assembly?
A prefetch path uses a relation object to specify what the relation is between parent and child. This is then used to produce subqueries so the child can be fetched using the proper filter on the parent. With selfservicing, the query is produced by the DAO belonging to the entity the collection is of.
So if you're fetching customers and orders, and customer is the prefetch path root, and orders is the child, fetching the orders is done by the orderdao, which is accessed through the OrderCollection, which is part of the prefetchpath element.
The prefetch path fetch itself is also done by the DAO, namely the one of the node to fetch. So as long as entitycollections and dao's are in the same assembly it should work fine.