Design of data classes that are shared between Web Services and Ap

Discussion in 'ASP .Net Web Services' started by madcowJack, Dec 20, 2007.

  1. madcowJack

    madcowJack Guest

    Does anyone know of Best Practices for the design of data classes which are
    read and written from and to the server ? We have a number of web apps that
    have similar needs and we want to build common data classes that represent
    the different scenarios.
    Specifically for one application we need a 'view' on a
    holders policy and in another circumstance we might only be interested in the
    'billing' info related to that policy. We want a common object which both the
    web service and web apps will build with. That way we only maintain the code
    in one place etc..

    I suppose my question is really what do other people use to design data
    classes and the namespaces associated with them ?
     
    madcowJack, Dec 20, 2007
    #1
    1. Advertising

  2. madcowJack

    Tiago Halm Guest

    I hope I'm reading your scenario correctly ... so let me give you my
    approach.

    I normally design a DAL (Data Access Layer) to access the database. I also
    design a BAL (Business Access Layer) which basically reflects the expected
    business scenario. Afterwards, this same BAL (an object object oriented
    model), can be exposed in several ways, where 2 of the most common are:

    ** WebApps
    In this case, and for GridView (as an example) I design a simple object
    without behavior to simply be used as an object data source for the
    GridView. This simple object is the one that knows how to bridge the BAL to
    itself. Basically, its not the BAL that is used directly in the ASP.NET
    controls, but an object which may be different according to the visual needs

    ** WebServices
    Again, in this case I design a simple object (DataContract) without behavior
    to simply be used as a flat structure for SOAP exposure. This simple
    structure, again, is the one that knows how to bridge the BAL to itself. And
    again, its not the BAL that is used directly in SOAP (WCF, WSDL), but an
    object which may be different according to the SOAP needs.

    To conclude, its the BAL that is shared. Each kind of exposure (which may be
    designed by other teams) is responsible for using the BAL indirectly to
    expose the required data performing any transformations it feels required
    (example: via WebApp a BAL numeric value is exposed with currency format,
    via WebService is exposed with numeric format and another property with the
    currency type).

    Hope it helps,
    Tiago Halm

    "madcowJack" <> wrote in message
    news:...
    > Does anyone know of Best Practices for the design of data classes which
    > are
    > read and written from and to the server ? We have a number of web apps
    > that
    > have similar needs and we want to build common data classes that represent
    > the different scenarios.
    > Specifically for one application we need a 'view' on a
    > holders policy and in another circumstance we might only be interested in
    > the
    > 'billing' info related to that policy. We want a common object which both
    > the
    > web service and web apps will build with. That way we only maintain the
    > code
    > in one place etc..
    >
    > I suppose my question is really what do other people use to design data
    > classes and the namespaces associated with them ?
     
    Tiago Halm, Dec 20, 2007
    #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. Nick
    Replies:
    1
    Views:
    6,183
    Alvin Bruney - ASP.NET MVP
    Sep 12, 2005
  2. james
    Replies:
    3
    Views:
    461
    John Harrison
    Feb 7, 2004
  3. sravan kumar
    Replies:
    0
    Views:
    449
    sravan kumar
    Jun 21, 2011
  4. John
    Replies:
    4
    Views:
    467
  5. Trevoke
    Replies:
    10
    Views:
    208
    Brian Candler
    Jul 22, 2009
Loading...

Share This Page