Way for building Database API for ASP.NET Application

Last post 11-07-2009 11:35 AM by TATWORTH. 4 replies.

Sort Posts:

  • Way for building Database API for ASP.NET Application

    11-04-2009, 3:36 AM
    • Member
      351 point Member
    • Spider.net
    • Member since 09-05-2008, 3:14 AM
    • Posts 145

    I want to create a C# API for ASP.NET Application. How to Create the API in C# for Storing and retrieving the data in sql.

    Am in confusion of how to define the API, whether I have to define separate class for connection of sql, and insert I have to define a separate class likewise for update and delete or we can define all the functionality in single class. Can anyone guide me in right in which which way I have to go.

    What is the best way for building Database API.

  • Re: Way for building Database API for ASP.NET Application

    11-04-2009, 5:49 AM
    • All-Star
      36,286 point All-Star
    • rtpHarry
    • Member since 10-01-2006, 12:51 PM
    • Lincoln, England
    • Posts 5,837

    Separate classes for each. This adheres to the Single Responsibility Principle and the Open/Closed Principle.

  • Re: Way for building Database API for ASP.NET Application

    11-06-2009, 9:29 AM
    Answer
    • Contributor
      5,908 point Contributor
    • atconway
    • Member since 09-24-2007, 9:20 PM
    • Florida U.S.A
    • Posts 1,236

    Hopefully I have not misunderstood your question - I read it several times to make sure I understood what you need.  It sounds like the 'API' you are attempting to build is really a DAL or Data Access Layer.  The DAL in its simplest form takes care of all communication to the Data Layer which could include maintingin your connections, CRUD, etc.  There are a lot of methods to designing the DAL and retrieving data, but in its basic form it can be a single binary (.dll) containing 1 or many classes that do the work that you need it to do to get back your data.

    Now typically this data is then translated into some type of business object to be used with the UI in a traditional UI -> BLL -> DAL arcitecture.  So to get you started I have some links that should help you with your design.

    Building an N-Tier Application in .NET:

    http://msdn.microsoft.com/en-us/library/ms973279.aspx

    Tutorial 1: Creating a Data Access Layer:

    http://msdn.microsoft.com/en-us/library/aa581778.aspx

    Implement a Data Access Layer for Your App with ADO.NET:

    http://msdn.microsoft.com/en-us/magazine/cc188750.aspx

    .NET Application Architecture: the Data Access Layer:

    http://www.simple-talk.com/dotnet/.net-framework/.net-application-architecture-the-data-access-layer/

    If you need more information or were talking about something different, please post back to this thread.

     

     

    Thank you,   >[Blog]<

    "The best thing about a boolean is even if you are wrong, you are only off by a bit." :D
    -anonymous

  • Re: Way for building Database API for ASP.NET Application

    11-07-2009, 10:34 AM
    • Star
      8,677 point Star
    • Pawan_Mishra
    • Member since 03-13-2008, 11:37 AM
    • Bangalore
    • Posts 1,266

    Hello

    Also you can refer to the following books on understanding how to architecture your application.

    1.) Architecturing Microsoft .net Solutins for the Enterprise by Dino Esposito , Andrea Saltarello

    In this book author clearly explains what should go in which layer . Also they explain design patterns etc with .Net framework in context there by making this book a must read.


    Regards
    Pawan Mishra

    Too many eyes doesn't make a good code !!!

    .Net 360°
  • Re: Way for building Database API for ASP.NET Application

    11-07-2009, 11:35 AM
    • All-Star
      62,859 point All-Star
    • TATWORTH
    • Member since 02-04-2003, 1:34 PM
    • England
    • Posts 12,270
    • TrustedFriends-MVPs

    >Architecturing Microsoft .net Solutins for the Enterprise by Dino Esposito , Andrea Saltarello

    That is an excellent book!

    Don't forget to click "Mark as Answer" on the post that helped you.
    This credits that member, earns you a point and marks your thread as Resolved so we will all know you have been helped.
Page 1 of 1 (5 items)