Using:
Adapter template.
LLBLGen Pro Version 2.6 Final (October 9th, 2009)
.Net 3.5
I have a table called Parcel that, despite the name holds Parcel and PersonalProperty records. There is a flag field called IsRE that identifies which type of record it is.
Parcel has a m-to-n relationship with Tract.
But this is split into two 1-n relationships via a mapping table called TractParcelMap.
So there is a 1-to-n relationship between Parcel and TractParcelMap and a 1-to-n relationship between Tract and TractParcelMap.
The LLBLGen code generated this method in the ParcelEntity class:
public virtual IRelationPredicateBucket GetRelationInfoTractCollectionViaTractParcelMap()
{
IRelationPredicateBucket bucket = new RelationPredicateBucket();
bucket.Relations.AddRange(GetRelationsForFieldOfType("TractCollectionViaTractParcelMap"));
bucket.PredicateExpression.Add(new FieldCompareValuePredicate(ParcelFields.ParcelId, null, ComparisonOperator.Equal, this.ParcelId, "ParcelEntity__"));
return bucket;
}
Later on, I decided to create a hierarchy of entities off of the Parcel table. The parent entity, which used to be called ParcelEntity is now called PropertyEntity. I made a new ParcelEntity class which is a sub-type of PropertyEntity which represents Properties that have the field IsRE = 1. I also made a PersonalPropertyEntityClass which is a sub-type of PropertyEntity which represents Properties that have the field IsRE = 0.
Since Tract records are only used by Parcels, not PersonalProperty, I did the tract relations with the ParcelEntity instead of the PropertyEntity.
However, when I generated the code, the new code for getting the TractCollectionViaTractParcelMap no longer specifies the predicate:
public virtual IRelationPredicateBucket GetRelationInfoTractCollectionViaTractParcelMap()
{
IRelationPredicateBucket bucket = new RelationPredicateBucket();
bucket.Relations.AddRange(GetRelationsForFieldOfType("TractCollectionViaTractParcelMap"));
return bucket;
}