Using entity collection to populate Datatable

Posts   
 
    
SamRose
User
Posts: 20
Joined: 24-Jun-2008
# Posted on: 14-Nov-2008 11:16:50   

Hi all,

Using the following code

        oCustomerProjectLinkEntityCollection = New EntityCollection(Of CustomerProjectLinkEntity)(New CustomerProjectLinkEntityFactory)


        oRelationPredicateBucket.PredicateExpression.Add(New FieldCompareValuePredicate(CustomerProjectLinkFields.CustomerGuid, Nothing, ComparisonOperator.Equal, CustomerGuid))

                Using oDataAccessAdapter As New DataAccessAdapter()
            oDataAccessAdapter.FetchEntityCollection(oProjectEntityCollection, oRelationPredicateBucket)
        End Using

I'm able to populate the collection.

I've used this to populate a datatable

        oPropertyProjectors.Add(New EntityPropertyProjector(CustomerProjectLinkFields.CustomerGuid, "CustomerGuid"))

        oDataTable = New DataTable
        oCustomerProjectLinkEntityCollection .DefaultView.CreateProjection(oPropertyProjectors, oDataTable)

which works lovely, but I was wondering if I could be clever.

Basically the collection contains a guid which relates to another table, I was wondering how I can access and populate a datatable with the related info.

I was thinking along the lines of this...

for each oCustomerProjectLinkEntity as CustomerProjectLinkEntity in oCustomerProjectLinkEntityCollection

oCustomerProjectLinkEntity.Project.ProjectName

next

which is accessible, I just didn't know how to incorporate this into the PropertyProjectors for a datatable.

Sam

Walaa avatar
Walaa
Support Team
Posts: 14993
Joined: 21-Aug-2005
# Posted on: 14-Nov-2008 12:36:59   
SamRose
User
Posts: 20
Joined: 24-Jun-2008
# Posted on: 04-Dec-2008 17:39:53   

Excellent, thank you