G
Good Enchiladas
I have an object model that exposes a class inheriting from collection base.
I would like to make this class available to an ASP.NET data grid, such as
in the following code:
grid.DataSource = MyObjectModel.MyCustomers.Filter("Smith%")
The problem is that MyCustomers is a lazy loading property of MyObjectModel
that, by default, returns ALL customers. So
"MyObjectModel.MyCustomers.Filter("Smith%")" first does the lazy load of ALL
customers THEN loads the customers filtered to the names beginning with
"Smith." The undesired initial lazy load is wasted.
How do I prevent this initial lazy load when a Filter method is called as in
above, but still retain the ability to make the very clean syntax of a call
such as "grid.DataSource = MyObjectModel.MyCustomers" when I want all
customers?
I would like to make this class available to an ASP.NET data grid, such as
in the following code:
grid.DataSource = MyObjectModel.MyCustomers.Filter("Smith%")
The problem is that MyCustomers is a lazy loading property of MyObjectModel
that, by default, returns ALL customers. So
"MyObjectModel.MyCustomers.Filter("Smith%")" first does the lazy load of ALL
customers THEN loads the customers filtered to the names beginning with
"Smith." The undesired initial lazy load is wasted.
How do I prevent this initial lazy load when a Filter method is called as in
above, but still retain the ability to make the very clean syntax of a call
such as "grid.DataSource = MyObjectModel.MyCustomers" when I want all
customers?