Hi, I'm using V2, Adapter, Vb & WinForm. In part of my data model I have these 3 tables:
Employee: EmployeeID, Employeename
EmployeeRole: EmployeeID, RoleID
Role: RoleID, RoleName
With these relationships: Employee -< EmployeeRole >- Role
For a selected Employee I need to display RoleName from table Role in a dataGridView.
I can display RoleID from table EmployeeRole via:
Function GetEmployeeRoles(ByVal EeID As Integer) As EntityCollection(Of EmployeeRoleEntity)
Dim employeeRoles As New EntityCollection(Of EmployeeRoleEntity)(New EmployeeRoleEntityFactory())
Dim prefetchPath As IPrefetchPath2 = New PrefetchPath2(CType(EntityType.EmployeeRoleEntity, Integer))
prefetchPath.Add(EmployeeRoleEntity.PrefetchPathEmployee)
Dim filter As IRelationPredicateBucket = New RelationPredicateBucket()
filter.PredicateExpression.Add(EmployeeRoleFields.EmployeeId = EeID)
Dim adapter As New DataAccessAdapter()
Try
adapter.FetchEntityCollection(employeeRoles, filter, prefetchPath)
Return employeeRoles
Finally
adapter.Dispose()
End Try
End Function
.. but I don't know how to get hold of RoleName from table Role. There's a generated RoleRelations class available, but how do I use it
Can anyone help ?
Thanks