I have a two entity tables, Catalog and Course, and a mapping table, CatalogCourseMap, that relates the two entities with a m:n relationship.
LLBLGen has generated a CatalogEntity with Courses property that allows access via the m:n relationship to a CourseEntityCollection. When iterating through the list of returned CourseEntities, I need to access the primary key value of the CatalogCourseMap record that relates the Catalog Entity to the Course Entity.
Currently I am performing a separate database call similar to the following:
IPredicateExpression filter = new PredicateExpression();
filter.Add(CatalogCourseMapFields.CatalogGuid == catalog.CatalogGuid);
filter.AddWithAnd(CatalogCourseMapFields.CourseGuid == course.CourseGuid);
CatalogCourseMapCollection catalogCourseMaps = course.GetMultiCatalogCourseMap(true, filter);
if (catalogCourseMaps.Count > 0)
{
CatalogCourseMapEntity catalogCourseMap = catalogCourseMaps[0];
return catalogCourseMap.CatalogCourseMapGuid;
}
Is there a way to access the CatalogCourseMapGuid for the implied relationship without a separate database call?