Custom collections


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Custom collections

  1. #1
    Chris Deceuninck Guest

    Custom collections


    Anyone got a solution for following problem:

    I've created a custom collection (inheriting from DictionaryBase) that serves
    as a cache object. Meaning when you are calling the Item method on the collection
    the method is checking first if the item you want is already available in
    its internal dictionary, if not it's retrieving it first from a datastore
    and placing it in its internal dictionary. The next time you ask for the
    same item you know it's comming from the dictionary.

    The problem is when I write my code with a hardcoded key like this:

    msgbox(object.Item("1002").Name)

    it just seems the item is already there and I'm pretty sure I'm only calling
    this method the first time since it's in a test application of a few lines.

    Now when asking for the key like this:

    msgbox(object.Item(Inputbox("Key")).Name)

    everything works like it should work.

    When attaching a webservice to the Item method, very strange debugging problems
    occur. The debugging is sometimes already stopping a few lines before this
    code or just skipping parts of the debugging and stopping when the webservice
    is actually returning the result. Always ending with an application that
    hangs.

    Anyone any suggestions,

    Chris



  2. #2
    Steve Guest

    Re: Custom collections


    Have you tried extracting the webservice statement to a seperate line? There
    may be complications or marshalling complications since the client and server
    are two seperate processes (even if tested on the same machine, it is 2 processes)

    Using the Inputbox() as an example:
    sUserInput = Inputbox("Key")
    msgbox(object.Item(sUserInput).Name)

    Extracting that statement might make it easier to debug, it also lends itself
    to be a bit cleaner so that you can check the collection with the key entered
    before attempting to access the element.

    Steve.

    "Chris Deceuninck" <deceuninck@yahoo.com> wrote:
    >
    >Anyone got a solution for following problem:
    >
    >I've created a custom collection (inheriting from DictionaryBase) that serves
    >as a cache object. Meaning when you are calling the Item method on the collection
    >the method is checking first if the item you want is already available in
    >its internal dictionary, if not it's retrieving it first from a datastore
    >and placing it in its internal dictionary. The next time you ask for the
    >same item you know it's comming from the dictionary.
    >
    >The problem is when I write my code with a hardcoded key like this:
    >
    >msgbox(object.Item("1002").Name)
    >
    >it just seems the item is already there and I'm pretty sure I'm only calling
    >this method the first time since it's in a test application of a few lines.
    >
    >Now when asking for the key like this:
    >
    >msgbox(object.Item(Inputbox("Key")).Name)
    >
    >everything works like it should work.
    >
    >When attaching a webservice to the Item method, very strange debugging problems
    >occur. The debugging is sometimes already stopping a few lines before this
    >code or just skipping parts of the debugging and stopping when the webservice
    >is actually returning the result. Always ending with an application that
    >hangs.
    >
    >Anyone any suggestions,
    >
    >Chris
    >
    >



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center