Tuesday, March 1, 2011

llblgen: How do i filter?

Hello,

Im having some problems with filtering data with LLBLGen. I have an EmployeeEntity where i want to fetch the data filtering by string CustomerNumber. CustomerNumber is not Primary Key. I guess i have to use the IPredicateExpression, but how?

EDIT: Im using the Adapter Model.

From stackoverflow
  • EmployeeCollection employees = new EmployeeCollection();
    employees.GetMulti(EmployeeFields.CustomerNumber == "123");
    
    Poku : Which namespace should i include to get the GetMulti function?
    cxfx : GetMulti() is a method of the CollectionClasses.EmployeeCollection object. This example is using LLBLGen's Self Service model, so if you're using the Adapter model then the solution will be different.
    Poku : im using the Adapter Model. Can you give an example with this?
  • You'll need to do something like this:

    IRelationPredicateBucket bucket = new RelationPredicateBucket();
    bucket.PredicateExpression.Add(EmployeeFields.CustomerNumber == "123");
    

    You can find a much more in-depth discussion here.

  • You can fetch lists using DataAccessAdapter.FetchEntities. The filtering can be done via PredicateExpressions. A nice documentation of the predicate system can be found here.

0 comments:

Post a Comment