CodeSmith Community
Your Code. Your Way. Faster!

Using .Find(IFilterParameterCollection parameter)

Latest post 05-23-2008 4:12 AM by dunkelelb. 10 replies.
  • 05-13-2008 7:28 AM

    Using .Find(IFilterParameterCollection parameter)

    Hello,

     

    I am absolutely new with that kind of 'framework'

    In the project I am ordered to work with where a lot of VIEWS I got to work with.

    Reduce that huge table , i want to use the .Find(IFilterParameterCollection parameter)  method. How do I have to use that method. 

    Running throw the generated code I could imagine, that for the parameter collection (coll of SqlFilterParameter(Enum column, String value, int index) just naming a column table name could be enough? )

     

    thanks 

     

     

     

     

     

     

    • Post Points: 35
  • 05-16-2008 11:40 AM In reply to

    • vbandrade
    • Top 25 Contributor
    • Joined on 09-27-2007
    • Brasil
    • Posts 231
    • Points 5,720

    Re: Using .Find(IFilterParameterCollection parameter)

    Check if this helps. Any doubts just ask.

     

    http://community.codesmithtools.com/forums/p/7979/29581.aspx#29581

     

    [s 

    • Post Points: 35
  • 05-21-2008 4:21 AM In reply to

    Re: Using .Find(IFilterParameterCollection parameter)

    thanks,

    That is the one half, nearly  

     

    I got something like name = @param.  ---How do I have to set the value to param?

     

    Service.find(query.GetParameters(value)) ?  

    • Post Points: 35
  • 05-21-2008 7:20 AM In reply to

    • vbandrade
    • Top 25 Contributor
    • Joined on 09-27-2007
    • Brasil
    • Posts 231
    • Points 5,720

    Re: Using .Find(IFilterParameterCollection parameter)

    dunkelellb look @ the example again.

    ....
    //Append an Equals operation, it will compare the FormTypeID column with e.Values["FormTypeID"]
    pb.AppendEquals(TTSFormColumn.FormTypeID,e.Values["FormTypeID"] );
    ....
    //fetch items
    TList<TTSForm> templates = formService.Find(pb.GetParameters());

     So the value is the second parameter of the AppendEquals method.
    So, supose you have a tale Costumer and you´re looking for the costumer who´s login is dunkelellb

    CostumerParameterBuilder pb = new CostumerParameterBuilder ();
    pb.AppendEquals(CostumerColumn.Loing, "dunkelellb ");

    TList<Costumer> result = costumerService.Find(pb.GetParameters());

    //another option, if you´re not using Service Layer
    TList<Costumer> result = DataRepository.CostumerProvider.Find(pb.GetParameters());

     

    Hope this helps. 

    • Post Points: 35
  • 05-21-2008 12:14 PM In reply to

    Re: Using .Find(IFilterParameterCollection parameter)

    okay,  it helped how it works, --> one question answered --> a new question as result:)

    now the critical question.

    Why using two method to create string? I don't see the useful difference which let say both are useful to let live both. i mean the result is the same, nearly.

    using .Find lets get the completList   

    .GetPaged(..)  lets get a certain part .

    well, I got a new question about .getPaged() 

      as a wannabe good programmer I cut gui and business.  gui ask business  and get some back (either int or list)

       So, with getPaged... I can set the number of items i wanna get.  (pageLength)

    1.  lets say the setted pageLength is below 'totacount' and my method has return VList<...>....

     so, how do i get the other items? I haven't found a property including the 'totalcount'

     2. lets say method return value int (returning just the maximum value 'totalcount' 

    in that case i got a full filled list and just return a single number.--> wasting resources. 

     with what I could get the values step-by-step as long the actual item number is smaller than 'totalcount'

    okay, you could say, that full filled list is organized as property of the searching class, so still usefull.

    ---> in that case: for that do i need thethings in Service.GetPaged(.... int start, int pageLength)

     

    or long story short. How do I get only the first 10 items and also the information the the complete would contain 200 items? 

    thanks. 

      

     

     

     

      

     

     

     

     

     

    • Post Points: 35
  • 05-22-2008 9:16 AM In reply to

    • vbandrade
    • Top 25 Contributor
    • Joined on 09-27-2007
    • Brasil
    • Posts 231
    • Points 5,720

    Re: Using .Find(IFilterParameterCollection parameter)

    Theres a lot of ways to find the total count of items in your database.

    Find, GetPaged and some other methods have an output parameter named "count" . That parameter is the total rows in your datasource.

    You cant have that property in TList or VList because it would be wrong. The Count property on the list should represent the number of items it contains, not the items in the database.

     Does that helps you to solve your problem?

     

    [s 

    • Post Points: 35
  • 05-22-2008 9:53 AM In reply to

    Re: Using .Find(IFilterParameterCollection parameter)

     I see it is difficult to describe, what I wanted 

     

    Lets say, for my Parameters there are 3000 positive Items in Database.

    I use the .GetPaged Method including Parameter pageLength 100.

     normally I put such queries I put in Methods and work with the return value.

    so in my programm I got now a list of 100 items. How do I know about the other 2900 item? 

    I got no Information about it, got just a full list of 100 items, because I wanted 100 per Page.

     

    the other way: GetPaged() PageLength 1 at the first query and my method don't return the list but the 'out totalnumber' 

    (so just an information query about length) afterwards with knowing about totalcount the first real query.

     is that two-step-way (first: information query for geting maximum, then query for getting some content)   really so really wanted?

    or it the other way: ask-and-see   what if I want all from Element 301 to 400 but the complete list has only 300 items? return 0 or 'null'

     

    thanks. 

     

     

    oh, can you answer an that? http://community.codesmithtools.com/forums/p/3932/31094.aspx#31094  

    I got problems to write a delegate for searching in a list (maye, a logical operator could be useful in VList<...>.FindAll( sds, sad, >=) ;-) 

     


     

     

     

     

     

     

     

    • Post Points: 35
  • 05-22-2008 11:11 AM In reply to

    • vbandrade
    • Top 25 Contributor
    • Joined on 09-27-2007
    • Brasil
    • Posts 231
    • Points 5,720

    Re: Using .Find(IFilterParameterCollection parameter)

    Theres a method GetTotalItems . It basically does a get paged with empty parameters and returns the total count. Never tested performance, tough.

    Im not sure I understand your problem... but if you use get paged to get your first listing, the out parameter count should have the total items in your database.

    What is exactly knowing about 2900 items? You want to have one list with all 3000 items??

     

    Sorry for not understanding your issue. ); 

    • Post Points: 35
  • 05-22-2008 11:26 AM In reply to

    Re: Using .Find(IFilterParameterCollection parameter)

     no problem.

     

    Why shouldn't I want to have all.    For watching I don't need all.  But for further work.

     My work have to do with  creating a skill database about employees of a huge company.  (with persons have the skills I need for something?)

    thousends of employee. such a table in outer join to another is still a huge view table.

     

    so you can choose, either a strong filter to get  the person you want to. (when sometimes the result is 0)

    and for everything asking the db  --> every time more or less waiting.  

    or one time asking the DB with basics to get a bigger  list.   

    --> so you got the list on your PC and can 'play' with it. (iterating searching) 

     

     

    --> i just use the official version 2.2.0 (SVN 603 i suppose)  --> it seems I'd better to SVN-Controlled actual version?

     

     

     

     

     

    • Post Points: 35
  • 05-22-2008 10:22 PM In reply to

    • vbandrade
    • Top 25 Contributor
    • Joined on 09-27-2007
    • Brasil
    • Posts 231
    • Points 5,720

    Re: Using .Find(IFilterParameterCollection parameter)

    Looks like you're making a windows application. 
    I'm just worried about the memory you're consuming keeping 3000 objects in memory. I would try do implement a caching system to keep the fetched entities. Its just my idea of how I would try to do it.

     

    I strongly recommend you to use the versions that are posted here: http://www.nettiers.com/builds/

    That's where the latest changes go. Or you can download the sources from here : http://nettiers.googlecode.com/svn/trunk/Source/

     

    • Post Points: 35
  • 05-23-2008 4:12 AM In reply to

    Re: Using .Find(IFilterParameterCollection parameter)

    Thanks for link.

     I haven't found it on the webpage. only the link to SVN.

     

     the easierst  way is setting a filter as strong as possible to reduce the return list. But for presenting I just need a part of the list.

    For iterate Searching I need the whole list. 


     

     


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