Web Service App design opinions

Discussion in 'ASP .Net Web Services' started by PaulMac, Oct 1, 2003.

  1. PaulMac

    PaulMac Guest

    I would like to hear opinions on Web Service App design in terms of where
    different developers have placed certain initialization or database
    connection code. For example, say we have a Web Service that uses ADO.NET
    to connect to a database. Where do you prefer to place the code to connect
    and disconnect? Each Web Method? A "global" area like the Web Service
    class constructor and destructors (Dispose)? How about somewhere in
    Global.ASAX? What if not all Web Methods needed the database connection?
    What is optimal in that case?

    I'll also add to this discussion that the garbage collection and/or
    connection pooling has been an issue for me. There have been problems where
    the database engine resource governor has throw an exception. Therefore,
    resources need to be released as soon as possible. I cannot follow the
    numerous .NET programming examples where objects and connections are made
    and aren't explicitly freed (allow the automatic mechanism to clean up).

    Paul
    PaulMac, Oct 1, 2003
    #1
    1. Advertising

  2. PaulMac

    Nathan Guest

    I would look at not doing any of this in the WS, but
    instead creating a seperate object that handles this. I
    would just have the WS use that object and be completely
    oblivious to those details.

    This will make unit testing much simpler as well as the
    object can be reused, i.e., not just in a WS. I think the
    seperation makes the design a bit more reusable and less
    coupled.

    my 2 cents.

    Nathan


    >-----Original Message-----
    >I would like to hear opinions on Web Service App design

    in terms of where
    >different developers have placed certain initialization

    or database
    >connection code. For example, say we have a Web Service

    that uses ADO.NET
    >to connect to a database. Where do you prefer to place

    the code to connect
    >and disconnect? Each Web Method? A "global" area like

    the Web Service
    >class constructor and destructors (Dispose)? How about

    somewhere in
    >Global.ASAX? What if not all Web Methods needed the

    database connection?
    >What is optimal in that case?
    >
    >I'll also add to this discussion that the garbage

    collection and/or
    >connection pooling has been an issue for me. There have

    been problems where
    >the database engine resource governor has throw an

    exception. Therefore,
    >resources need to be released as soon as possible. I

    cannot follow the
    >numerous .NET programming examples where objects and

    connections are made
    >and aren't explicitly freed (allow the automatic

    mechanism to clean up).
    >
    >Paul
    >
    >
    >.
    >
    Nathan, Oct 1, 2003
    #2
    1. Advertising

  3. Hello Paul,

    Thanks for posting in the group.

    Data access is a hot topic in .net programming. We often meet questions
    like "when to release connection", "where to store connection string" and
    etc. In MSDN, there are many good articles in this area. Here are some that
    I recommend to you:

    ".NET Data Access Architecture Guide"
    http://msdn.microsoft.com/library/en-us/dnbda/html/daag.asp?frame=true
    This document provides guidance to help you choose the most appropriate
    data access approach. It does so by detailing a wide range of common data
    access scenarios, providing performance tips, and prescribing best
    practices. This document also provides answers to other frequently asked
    questions: Where's the best place to store database connection strings? How
    should I implement connection pooling? How should I work with transactions?
    How should I implement paging to allow users to scroll through large
    numbers of records?

    "Best Practices for Using ADO.NET"
    http://msdn.microsoft.com/library/en-us/dnadonet/html/adonetbest.asp?frame=t
    rue
    This article provides you with the best solutions for implementing and
    achieving optimal performance, scalability, and functionality in your
    Microsoft ADO.NET applications; it also covers best practices when using
    objects available in ADO.NET and offers suggestions that can help you
    optimize the design of your ADO.NET application.

    The same principles apply to asp.net web service applications also.

    Hope that helps.

    Best regards,
    Yanhong Huang
    Microsoft Online Partner Support

    Get Secure! - www.microsoft.com/security
    This posting is provided "AS IS" with no warranties, and confers no rights.

    --------------------
    !From: "PaulMac" <>
    !Subject: Web Service App design opinions
    !Date: Wed, 1 Oct 2003 11:13:28 -0400
    !Lines: 19
    !X-Priority: 3
    !X-MSMail-Priority: Normal
    !X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
    !X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
    !Message-ID: <#>
    !Newsgroups: microsoft.public.dotnet.framework.aspnet.webservices
    !NNTP-Posting-Host: 65.162.128.158
    !Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP10.phx.gbl
    !Xref: cpmsftngxa06.phx.gbl
    microsoft.public.dotnet.framework.aspnet.webservices:19654
    !X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webservices
    !
    !I would like to hear opinions on Web Service App design in terms of where
    !different developers have placed certain initialization or database
    !connection code. For example, say we have a Web Service that uses ADO.NET
    !to connect to a database. Where do you prefer to place the code to connect
    !and disconnect? Each Web Method? A "global" area like the Web Service
    !class constructor and destructors (Dispose)? How about somewhere in
    !Global.ASAX? What if not all Web Methods needed the database connection?
    !What is optimal in that case?
    !
    !I'll also add to this discussion that the garbage collection and/or
    !connection pooling has been an issue for me. There have been problems
    where
    !the database engine resource governor has throw an exception. Therefore,
    !resources need to be released as soon as possible. I cannot follow the
    !numerous .NET programming examples where objects and connections are made
    !and aren't explicitly freed (allow the automatic mechanism to clean up).
    !
    !Paul
    !
    !
    !
    Yan-Hong Huang[MSFT], Oct 2, 2003
    #3
  4. PaulMac

    PaulMac Guest

    Hi Yanhong,

    Thank you for the link to that excellent information. It answers a lot of
    questions.

    Paul Mac


    "Yan-Hong Huang[MSFT]" <> wrote in message
    news:...
    > Hello Paul,
    >
    > Thanks for posting in the group.
    >
    > Data access is a hot topic in .net programming. We often meet questions
    > like "when to release connection", "where to store connection string" and
    > etc. In MSDN, there are many good articles in this area. Here are some

    that
    > I recommend to you:
    >
    > ".NET Data Access Architecture Guide"
    > http://msdn.microsoft.com/library/en-us/dnbda/html/daag.asp?frame=true
    > This document provides guidance to help you choose the most appropriate
    > data access approach. It does so by detailing a wide range of common data
    > access scenarios, providing performance tips, and prescribing best
    > practices. This document also provides answers to other frequently asked
    > questions: Where's the best place to store database connection strings?

    How
    > should I implement connection pooling? How should I work with

    transactions?
    > How should I implement paging to allow users to scroll through large
    > numbers of records?
    >
    > "Best Practices for Using ADO.NET"
    >

    http://msdn.microsoft.com/library/en-us/dnadonet/html/adonetbest.asp?frame=t
    > rue
    > This article provides you with the best solutions for implementing and
    > achieving optimal performance, scalability, and functionality in your
    > Microsoft ADO.NET applications; it also covers best practices when using
    > objects available in ADO.NET and offers suggestions that can help you
    > optimize the design of your ADO.NET application.
    >
    > The same principles apply to asp.net web service applications also.
    >
    > Hope that helps.
    >
    > Best regards,
    > Yanhong Huang
    > Microsoft Online Partner Support
    PaulMac, Oct 2, 2003
    #4
  5. Hi Paul,

    It is my pleasure. :)

    Thanks for participating the community.

    Best regards,
    Yanhong Huang
    Microsoft Online Partner Support

    Get Secure! - www.microsoft.com/security
    This posting is provided "AS IS" with no warranties, and confers no rights.

    --------------------
    !From: "PaulMac" <>
    !References: <#>
    <>
    !Subject: Re: Web Service App design opinions
    !Date: Thu, 2 Oct 2003 09:13:09 -0400
    !Lines: 52
    !X-Priority: 3
    !X-MSMail-Priority: Normal
    !X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
    !X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
    !Message-ID: <>
    !Newsgroups: microsoft.public.dotnet.framework.aspnet.webservices
    !NNTP-Posting-Host: 65.162.128.158
    !Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP10.phx.gbl
    !Xref: cpmsftngxa06.phx.gbl
    microsoft.public.dotnet.framework.aspnet.webservices:19686
    !X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webservices
    !
    !Hi Yanhong,
    !
    !Thank you for the link to that excellent information. It answers a lot of
    !questions.
    !
    !Paul Mac
    !
    !
    !"Yan-Hong Huang[MSFT]" <> wrote in message
    !news:...
    !> Hello Paul,
    !>
    !> Thanks for posting in the group.
    !>
    !> Data access is a hot topic in .net programming. We often meet questions
    !> like "when to release connection", "where to store connection string" and
    !> etc. In MSDN, there are many good articles in this area. Here are some
    !that
    !> I recommend to you:
    !>
    !> ".NET Data Access Architecture Guide"
    !> http://msdn.microsoft.com/library/en-us/dnbda/html/daag.asp?frame=true
    !> This document provides guidance to help you choose the most appropriate
    !> data access approach. It does so by detailing a wide range of common data
    !> access scenarios, providing performance tips, and prescribing best
    !> practices. This document also provides answers to other frequently asked
    !> questions: Where's the best place to store database connection strings?
    !How
    !> should I implement connection pooling? How should I work with
    !transactions?
    !> How should I implement paging to allow users to scroll through large
    !> numbers of records?
    !>
    !> "Best Practices for Using ADO.NET"
    !>
    !http://msdn.microsoft.com/library/en-us/dnadonet/html/adonetbest.asp?frame=
    t
    !> rue
    !> This article provides you with the best solutions for implementing and
    !> achieving optimal performance, scalability, and functionality in your
    !> Microsoft ADO.NET applications; it also covers best practices when using
    !> objects available in ADO.NET and offers suggestions that can help you
    !> optimize the design of your ADO.NET application.
    !>
    !> The same principles apply to asp.net web service applications also.
    !>
    !> Hope that helps.
    !>
    !> Best regards,
    !> Yanhong Huang
    !> Microsoft Online Partner Support
    !
    !
    !
    Yan-Hong Huang[MSFT], Oct 3, 2003
    #5
    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. Will Hartung

    Opinions on Oracle's App Server?

    Will Hartung, Sep 17, 2003, in forum: Java
    Replies:
    0
    Views:
    354
    Will Hartung
    Sep 17, 2003
  2. John Doe
    Replies:
    3
    Views:
    403
    Sandeep
    Jul 9, 2003
  3. Tim H

    design opinions requested

    Tim H, Jun 3, 2007, in forum: C++
    Replies:
    15
    Views:
    553
    Daniel T.
    Jun 4, 2007
  4. rep_movsd

    Library design opinions...

    rep_movsd, Jun 27, 2008, in forum: C++
    Replies:
    6
    Views:
    851
    rep_movsd
    Jun 27, 2008
  5. max w.
    Replies:
    4
    Views:
    660
Loading...

Share This Page