Click here to Skip to main content
15,885,985 members
Articles / Programming Languages / C#

Data Accessing Independent From Database And Entity With ADO.Net

Rate me:
Please Sign up or sign in to vote.
4.93/5 (10 votes)
26 Nov 2012CPOL11 min read 26.7K   1K   32  
This tutorial aims to show a basic approach for designing a data access layer independent from databases and entities.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DataAccess;
using TestWebAppLication.Properties;

namespace TestWebAppLication
{
    public partial class Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            DataAccessProvider dap = new DataAccessProvider(Settings.Default.MusicDBConnectionString,DatabaseType.SqlCompact);
            var musics = dap.SelectAll("Music");
            foreach (var item in musics)
            {
                Response.Write(item.Artist); 
                Response.Write(item.Song);
                Response.Write(item.Html);
            }
        }
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer RkSoft GIS Solutions
Turkey Turkey
A recent graduate. Interested in .Net technologies especially on c# language, silverligt and wpf. Also jQuery is one of the interests. Now improwing skills in a development company and learning more everyday.

Comments and Discussions