Reply to thread

[CODE]    public IList<TuningDetail> ReferringTuningDetail()

    {

      //select * from 'foreigntable'

      SqlBuilder sb = new SqlBuilder(StatementType.Select, typeof (TuningDetail));


      // where foreigntable.foreignkey = ourprimarykey

      sb.AddConstraint(Operator.Equals, "idChannel", idChannel);


      // passing true indicates that we'd like a list of elements, i.e. that no primary key

      // constraints from the type being retrieved should be added to the statement

      SqlStatement stmt = sb.GetStatement(true);


      // execute the statement/query and create a collection of User instances from the result set

      return ObjectFactory.GetCollection<TuningDetail>(stmt.Execute());


      // TODO In the end, a GentleList should be returned instead of an arraylist

      //return new GentleList( typeof(TuningDetail), this );

    }[/CODE]

this code is really like "select * from TuningDetails where idChannel = :idChannel". there is anyway only one record can be returned. So we need to ask  e.g. "select * from TuningDetails where isTV = true" once, put the result in a dictionary, and then ask dictionary when filling listviews - i believe dictionary search in memory is faster than thousands of sql queries...


Top Bottom