Hi Derek,
Derek wrote:
Normally, I would use the code to define the relationship:
RelationPredicateBucket bucket = new RelationPredicateBucket();
bucket.Relations.Add(ReportHistoryEntity.Relations.ReportHistoryEntityUsingConsumerId);
but b/c there is no foreign key relationship defined, this relation does not exist. Is it possible to create a relationship outside of defining it as a foreign key relation and doing a code regen?
You can create a relationship for fetch intention. Something like:
IEntityRelation customNewRelation = new EntityRelation(CustomerEntityFields.CustomerId, ReportHistoryEntityFields.CustomerId, RelationType.OneToMany);
RelationPredicateBucket bucket = new RelationPredicateBucket();
bucket.Relations.Add(customNewRelation);
You need to do this everywhere you use similar approach. However, if there are many places to do that, I would recommend you create such relation in designer. What is the problem with that? If that is not the case, you can simply use the code I gave above.
Hope helpful