Once I have the tables related, how do I access and display the fields from the related table?
LLBLGEN V 2.6
Adapter
C#
I am relating the tables on an id field common to the tables but not a primary key in either however I need only the Name field from the related table. Here is my code to get a list of items.
public static EntityView2<EntityBase2> RetrieveInstitutionList(int wId)
{
var institutions = new EntityCollection(new UWInstitutionEntityFactory());
var myCustRelation = new EntityRelation(RelationType.OneToMany, true);
myCustRelation.AddEntityFieldPair(UWInstitutionFields.InstitutionId, InstitutionFields.InstitutionId);
using (var adapter = new DataAccessAdapter())
{
var pageBucket = new RelationPredicateBucket();
IPredicateExpression filter = new PredicateExpression();
filter.Add(UWInstitutionFields.uwId == wId);
pageBucket.Relations.Add(myCustRelation);
pageBucket.PredicateExpression.Add(filter);
var sorter = new SortExpression(UWInstitutionFields.Id | SortOperator.Ascending);
adapter.FetchEntityCollection(institutions, pageBucket, 5000, sorter);
}
return institutions.DefaultView;
}