CodeSmith Community
Your Code. Your Way. Faster!

Remove/filter from list collection, but not Delete

Latest post 02-18-2008 4:38 PM by iatek. 1 replies.
  • 02-15-2008 12:28 PM

    • iatek
    • Top 500 Contributor
    • Joined on 08-03-2007
    • Posts 18
    • Points 270

    Remove/filter from list collection, but not Delete

    Hi,

    I have some custom permission related logic that I like to implement in the GetSelectData method in the (Entity)DataSource classes, after the results IList is created by the switch statement that handles the various Select methods (GetAll, GetPaged, GetBy.., etc..). I basically need to conditionally filter out some of the results. Since there is no Filter method on the IList, I thought it best to use the .Remove method to take the entity items out of the returned collection so they're not displayed in the results, but this seems to mess up paging and sometimes the entities get Deleted all together from the database. Is there anyway to filter some of the results from the IList before they're returned by GetSelectData?

    Another method I've considered is using ((ListBase)results).Filter = "XXX", but this also seems to throw the count off as well.

    TIA for any suggestions!

    Skelly
    Filed under: ,
    • Post Points: 5
  • 02-18-2008 4:38 PM In reply to

    • iatek
    • Top 500 Contributor
    • Joined on 08-03-2007
    • Posts 18
    • Points 270

    Re: Remove/filter from list collection, but not Delete

    Any ideas? I guess what I really need to know is.. once I apply a filter to the list... how can I fix the paged results?

    Skelly
    • Post Points: 5
Page 1 of 1 (2 items) | RSS
Copyright © 2008 CodeSmith Tools, LLC
Powered by Community Server (Commercial Edition), by Telligent Systems