creating a BED properties class with web services

Discussion in 'ASP .Net Web Services' started by steven, Dec 4, 2007.

  1. steven

    steven Guest

    hi

    i'm working on a web site (written in .net 1.1) that makes heavy use
    of web services written in .net 2.0. the web site needs to sniff the
    URL being used and set certain parameters like db connections (to the
    QA or Production DB based on the URL). these properties should all be
    captured in an AppConfig properties class and passed to the web
    service. I'd like the AppConfig properties class to be written as a
    web service, but there doesn't seem to be any support for things like:

    <WebMethod()> _
    Public Property DBConn()
    Get
    Return _dbConn
    End Get
    Set(ByVal value)
    _dbConn = value
    End Set
    End Property

    i guess i could create this properties class with a bunch of functions
    to do this:

    <WebMethod()>_
    Public Function GetDbConn as String
    return _dbConn
    End Function

    <WebMethod()>_
    Public Sub SetDbConn(ByVal sDbConn As String)
    _dbConn = sDbConn
    End Sub

    but is there a more elegant way of doing this?

    any suggestions appreciated.

    tks
     
    steven, Dec 4, 2007
    #1
    1. Advertising

  2. "steven" <> wrote in message
    news:...
    > hi
    >
    > i'm working on a web site (written in .net 1.1) that makes heavy use
    > of web services written in .net 2.0. the web site needs to sniff the
    > URL being used and set certain parameters like db connections (to the
    > QA or Production DB based on the URL). these properties should all be
    > captured in an AppConfig properties class and passed to the web
    > service. I'd like the AppConfig properties class to be written as a
    > web service, but there doesn't seem to be any support for things like:
    >
    > <WebMethod()> _
    > Public Property DBConn()
    > Get
    > Return _dbConn
    > End Get
    > Set(ByVal value)
    > _dbConn = value
    > End Set
    > End Property
    >
    > i guess i could create this properties class with a bunch of functions
    > to do this:
    >
    > <WebMethod()>_
    > Public Function GetDbConn as String
    > return _dbConn
    > End Function
    >
    > <WebMethod()>_
    > Public Sub SetDbConn(ByVal sDbConn As String)
    > _dbConn = sDbConn
    > End Sub
    >
    > but is there a more elegant way of doing this?
    >
    > any suggestions appreciated.


    Sorry, web methods can only be methods.

    Furthermore, you should consider something more granular. Keep in mind that
    each reference to a web method is a request/response pair. You don't really
    want to do 10 separate request/response exchanges just to fetch 10
    properties.

    Instead, consider wrapping a set of properties in a class, and have a single
    web method called, say, "GetConfigurationProperties" that returns the entire
    set. The client can then access the individual properties however it likes.
    --
    --------------------------------------------------------------------------------
    John Saunders | MVP - Windows Server System - Connected System Developer

    --
    --------------------------------------------------------------------------------
    John Saunders | MVP - Windows Server System - Connected System Developer
     
    John Saunders [MVP], Dec 5, 2007
    #2
    1. Advertising

  3. steven

    steven Guest

    On Dec 5, 4:35 pm, "John Saunders [MVP]" <john.saunders at
    trizetto.com> wrote:
    > "steven" <> wrote in message
    >
    > news:...
    >
    >
    >
    >
    >
    > > hi

    >
    > > i'm working on a web site (written in .net 1.1) that makes heavy use
    > > of web services written in .net 2.0. the web site needs to sniff the
    > > URL being used and set certain parameters like db connections (to the
    > > QA or Production DB based on the URL). these properties should all be
    > > captured in an AppConfig properties class and passed to the web
    > > service. I'd like the AppConfig properties class to be written as a
    > > web service, but there doesn't seem to be any support for things like:

    >
    > > <WebMethod()> _
    > > Public Property DBConn()
    > > Get
    > > Return _dbConn
    > > End Get
    > > Set(ByVal value)
    > > _dbConn = value
    > > End Set
    > > End Property

    >
    > > i guess i could create this properties class with a bunch of functions
    > > to do this:

    >
    > > <WebMethod()>_
    > > Public Function GetDbConn as String
    > > return _dbConn
    > > End Function

    >
    > > <WebMethod()>_
    > > Public Sub SetDbConn(ByVal sDbConn As String)
    > > _dbConn = sDbConn
    > > End Sub

    >
    > > but is there a more elegant way of doing this?

    >
    > > any suggestions appreciated.

    >
    > Sorry, web methods can only be methods.
    >
    > Furthermore, you should consider something more granular. Keep in mind that
    > each reference to a web method is a request/response pair. You don't really
    > want to do 10 separate request/response exchanges just to fetch 10
    > properties.
    >
    > Instead, consider wrapping a set of properties in a class, and have a single
    > web method called, say, "GetConfigurationProperties" that returns the entire
    > set. The client can then access the individual properties however it likes.


    tks for the advice, john. my approch was feeling a little forced.

    > --
    > ---------------------------------------------------------------------------------
    > John Saunders | MVP - Windows Server System - Connected System Developer
    >
    > --
    > ---------------------------------------------------------------------------------
    > John Saunders | MVP - Windows Server System - Connected System Developer- Hide quoted text -
    >
    > - Show quoted text -
     
    steven, Dec 6, 2007
    #3
    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. ELat
    Replies:
    0
    Views:
    330
  2. Nick
    Replies:
    1
    Views:
    6,219
    Alvin Bruney - ASP.NET MVP
    Sep 12, 2005
  3. SuperZE
    Replies:
    5
    Views:
    354
    SuperZE
    Oct 6, 2008
  4. John
    Replies:
    4
    Views:
    485
  5. James Britt
    Replies:
    12
    Views:
    188
    Charles Oliver Nutter
    Sep 15, 2008
Loading...

Share This Page