I want to look up an entity in a collection with read entities. Is there a Find method in the Entity collections?
You can find entities easily with in-memory filtering on an entitycollection. Take for example the following code, which finds the CustomerEntity with the PK "CHOPS" in the customer collection. This works for both Adapter and SelfServicing. It will use the DefaultView object for this.
CustomerCollection customers = new CustomerCollection();
// get all customers
IEntityView view = customers.DefaultView;
// filter view
view.Filter = (CustomerFields.CustomerId == "CHOPS");
// get a reference to the entity to find:
CustomerEntity toFind = view;
Dim customers As New CustomerCollection()
' get all customers
Dim view As IEntityView = customers.DefaultView
' filter view
view.Filter = New FieldCompareValuePredicate(CustomerFields.CustomerId, _
' get a reference to the entity to find:
CustomerEntity toFind = view(0)