Fetch entity with filter

Posts   
 
    
GSLakmal
User
Posts: 1
Joined: 09-Feb-2009
# Posted on: 25-Jun-2009 11:21:34   

I have following entity

ItemEntity item = new ItemEntity();

item entity have field called AppId. I want get itementity which belongs to given appid.

How can i do that.

This is not fetchcollection. This fetch only single entity

I want use adapter.FetchEntity() or something and get ItemEntity .

How can i do that?

Walaa avatar
Walaa
Support Team
Posts: 14993
Joined: 21-Aug-2005
# Posted on: 25-Jun-2009 11:41:58   

Is AppId unique in the ItemEntity table?

If so, you can Fetch using a unique constranit: Adapter example:

DataAccessAdapter adapter = new DataAccessAdapter();
CustomerEntity customer = new CustomerEntity();
customer.CompanyName = "Chop-suey Chinese";
adapter.FetchEntityUsingUniqueConstraint(customer, customer.ConstructFilterForUCCompanyName());

Or you can use adapter.FetchNewEntity(); which accepts a relationPredicateBucket.