LLBLGenProDataSource

Posts   
 
    
Posts: 3
Joined: 18-Sep-2006
# Posted on: 18-Sep-2006 11:56:51   

Hello!

I have a method


public MyObjectCollection GetMyObjects()
{
   MyObjectCollection myObjects = new MyObjectCollection();
   IPredicate filter = (MyObjectFields.Approved == true);
   SortExpression sort = new SortExpression(MyObjectFields.Created | SortOperator.Descending);          
            myObjects .GetMulti(filter, 10000, sort);
            return myObjects ;
}

then in Page_Load:


MyObjectHandler handler = new MyObjectHandler();

LLBLGenProDataSource1.DataContainerType = SD.LLBLGen.Pro.ORMSupportClasses.DataSourceDataContainerType.EntityCollection; 

LLBLGenProDataSource1.EntityCollection = handler.GetMyObjects();

But the gridview always shows all the posts in the table, ignoring my filtering in the method.

the markup for the datasource is:


<llblgenpro:LLBLGenProDataSource ID="LLBLGenProDataSource1" runat="server" EnablePaging="True">
</llblgenpro:LLBLGenProDataSource>

Any ideas?

Jessynoo avatar
Jessynoo
Support Team
Posts: 296
Joined: 19-Aug-2004
# Posted on: 18-Sep-2006 21:03:31   

Hi,

Since the datasource keeps in charge of the persistence mechanism, you've got to apply your filter in another place:

Either set its "FilterToUse" property, or intercept and implement the "PerformSelect" event manually (disable the livepersistence feature)

Hope that helps