Problem with FetchEntityCollection

Posts   
 
    
Wade
User
Posts: 76
Joined: 15-Jun-2004
# Posted on: 10-Apr-2008 19:17:20   

It is not a bug, but a problem we are having with the generated code in the Business Object Layer.

We want to Fetch an EntityCollection with a Filter and we do not want any of the relationships pre-fetched back.

Also, we are using the Adapter 2 class generation.

Basically if I am fetching Customers Collection with a filter on Name, but I do not want any of the orders or other related entities returned.

Please provide a code sample if you can.

Thanks,

JimFoye avatar
JimFoye
User
Posts: 656
Joined: 22-Jun-2004
# Posted on: 11-Apr-2008 00:00:02   

            EntityCollection<CustomerEntity> customers = new EntityCollection<CustomerEntity>();
            RelationPredicateBucket bucket = new RelationPredicateBucket();
            bucket.PredicateExpression.Add(CustomerFields.Name == "Smith");

            DataAccessAdapter adapter = new DataAccessAdapter();
            adapter.FetchEntityCollection(customers, bucket);

[Edit] had to correct the code.

Wade
User
Posts: 76
Joined: 15-Jun-2004
# Posted on: 11-Apr-2008 06:04:21   

We tried this but we still get all the relationships fetched back at the same time. What we are wanting to do is create a grid based series of admin screens for look up table values. In the DB they have 1:M relationships where they are being used. We also want to use the power of the entity collection in the bound grid component. Any ideas here?

Thanks!

Walaa avatar
Walaa
Support Team
Posts: 14946
Joined: 21-Aug-2005
# Posted on: 11-Apr-2008 11:00:59   

We tried this but we still get all the relationships fetched back at the same time

How come? Are you sure you are using the Adapter model, not the SelfServicing one?

Would you please provide a code snippet of what you are trying and how you test for the existance of the related entities?

Wade
User
Posts: 76
Joined: 15-Jun-2004
# Posted on: 11-Apr-2008 15:48:04   

Here is the code we are using and it is being bound to an infragistics grid that supports relationships automatically and we do not want the relationships showing up for this screen.


                sopcode = sopcode.Trim() + "%";

                PredicateExpression filters = new PredicateExpression();
                filters.Add(new FieldLikePredicate(OperationFields.OperationName, null, sopcode));
            
                            
                RelationPredicateBucket bucket = new RelationPredicateBucket(filters);
            

                using (DataAccessAdapter adapter = new DataAccessAdapter())
                {
                    adapter.FetchEntityCollection(operations, bucket);
                }


Please tell us what we are doing wrong.

Walaa avatar
Walaa
Support Team
Posts: 14946
Joined: 21-Aug-2005
# Posted on: 11-Apr-2008 16:37:43   

Here is the code we are using and it is being bound to an infragistics grid that supports relationships automatically and we do not want the relationships showing up for this screen.

The mentioned code doesn't fetch the related entities and collections. But the properties/fields mapped on these entities exist in the main entity object.

I think that's infragistic grid issue (to not display in ahierarchical mode).

Wade
User
Posts: 76
Joined: 15-Jun-2004
# Posted on: 11-Apr-2008 18:19:19   

We finally figured it out to be a problem in the Infragistics XamDataGrid. There is a bit flag to turn off the Higherarchy drill-down. Plus, we confirmed the data is not being returned.

Thanks for all the help!