ObjectDataSource

Discussion in 'ASP .Net Web Controls' started by doug, Jan 11, 2006.

  1. doug

    doug Guest

    Hello,

    I wish to use declarative datasources as much as possible. Using an
    ObjectDataSource makes sense in a few situations.

    I see that the TypeName is used to instantiate an object and methods are
    called, and parameter can be identified, and feed to the method.

    My question is, if i have an object already created as an httphander (ref
    would be httpcontext.Users say). Can the reference this object, say
    getallusers(), in using an ObjectDataSource?

    doug
     
    doug, Jan 11, 2006
    #1
    1. Advertising

  2. Problem you'll run into if you need an instance is that the ODS will create
    an instance of whatever object you specify itself for every single call, so
    if you were to provide it with a handler as your typename, it will create a
    separate instance of the type and call *that* object's method rather than
    your handler's.
    The more efficient way to use ODS is to expose static methods of a class so
    that the ODS doesn't attempt to do a default construction of an instance of
    the specified object. So in answer to your question, I am pretty sure the
    answer it "no" if you need to instantiate the object yourself, unless
    there's some trick in there that I've missed (in my own case, I just used
    static methods because it fit into my app better)
     
    Keith Patrick, Jan 11, 2006
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. WertmanTheMad

    objectDataSource

    WertmanTheMad, Sep 15, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    359
    WertmanTheMad
    Sep 15, 2004
  2. WertmanTheMad

    Arrrrg !!!! ObjectDataSource Issues

    WertmanTheMad, Oct 8, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    1,200
    WertmanTheMad
    Oct 8, 2004
  3. =?Utf-8?B?RG9u?=

    ObjectDataSource

    =?Utf-8?B?RG9u?=, Nov 22, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    415
    =?Utf-8?B?RG9u?=
    Nov 22, 2004
  4. Microsoft news
    Replies:
    2
    Views:
    9,266
  5. David Thielen

    ObjectDataSource method as another ObjectDataSource

    David Thielen, Mar 21, 2006, in forum: ASP .Net Web Controls
    Replies:
    3
    Views:
    245
    Steven Cheng[MSFT]
    Mar 23, 2006
Loading...

Share This Page