Hi,
I have a method in my DAL returning a list of Customers:
Collection<Customer> FindAllCustomers();
The Customer has these columns: ID, Name, Address, Bio
I need to show them in a paged grid in my ASPX form (show-customers.aspx) where I'll be showing only these columns: ID, Name
Now, in my DAL FindAllCustomers(), do I return the Bio field too from the SP (I am filling in the collection using a reader)? The Bio field can be large (nvarchar(max)). I was thinking of lazy loading or loading only the required fields. But then in that case I would need to create another method which returns a "full" list of customers including the bio so that 3rd party apps can use it through a service layer. So is it ok to create a method like this:
Collection<Customer> FindAllCustomers(bool loadPartial);
If loadPartial = true, then do not load Bio, else load it. In this case since I do not want to return the Bio from the SP, I would need to create 2 select statements in my SP based on the bool value.
I think using lazy loading here will not work, because then the DAL method can be accessed by a 3rd party app, which might want to load the bio too.
Any suggestions on the best pattern to implement in such cases?
thanks,
Vikas