Click here to Skip to main content
Click here to Skip to main content
Articles » Web Development » ASP.NET » Data » Downloads
 
Add your own
alternative version

Designing and implementing a versatile data access tier for an ASP.NET application

, 3 Feb 2003
In this article, we will drill down deeper in to the design of a n-tier architecture and our focus will be on the data access tier (DAT)
DAPrototype.zip
DAPrototype
BLT
BLT.csproj.user
DAPrototype.csproj.webinfo
DAPrototype.suo
DAPrototype.vsdisco
DAT
DAT.csproj.user
DAT.jpg
DAT.suo
DAT.vsd
DATest.vsd
DATier.jpg
DATier.omt
DATier.WC
Initial Class Diagram.jpg
With.omt
With.WC
ELCreator
App.ico
ELCreator.csproj.user
ELCreator.suo
Global.asax
HttpTraceModule
HttpTraceModule.csproj.user
images
PublishText
DATier.doc
SqlScript
TDS
Dataset1.xsx
DSCustomer.xsx
DSOrderDetail.xsx
TDS.csproj.user
_private
_vti_cnf
DAPrototype.csproj.webinfo
DAPrototype.suo
DAPrototype.vsd
DAPrototype.vsdisco
ELCreator.zip
Global.asax
_vti_pvt
access.cnf
deptodoc.btr
doctodep.btr
service.cnf
service.lck
services.cnf
_vti_script
_vti_txt
DATier.zip
BLT.csproj.user
DAPrototype.csproj.webinfo
DAPrototype.suo
DAPrototype.vsdisco
DAT.csproj.user
DAT.jpg
DAT.suo
DAT.vsd
DATest.vsd
DATier.jpg
DATier.omt
DATier.WC
Initial Class Diagram.jpg
With.omt
With.WC
App.ico
ELCreator.csproj.user
ELCreator.suo
Global.asax
HttpTraceModule.csproj.user
Dataset1.xsx
DSCustomer.xsx
DSOrderDetail.xsx
TDS.csproj.user
using System;
using System.Diagnostics;
using System.Configuration;

namespace BLT
{
	/// <summary>
	/// Summary description for BLBasis.
	/// </summary>
	public class BLBasis
	{

		// EventLog for Buisness Logic Tier
		protected static EventLog daEventLog;
		// strings to connect EventLog
		protected static string strLog;
		protected static string strSource;
		protected static string strMachine;

		protected static decimal dConsumeTaxRate;
		public BLBasis()
		{
			
		}

		static BLBasis()
		{
			// strings to connect the EventLog
			strLog = ConfigurationSettings.AppSettings["blLog"];
			strSource = ConfigurationSettings.AppSettings["blSource"];
			strMachine = ConfigurationSettings.AppSettings["blMachine"];
			dConsumeTaxRate = Convert.ToDecimal(ConfigurationSettings.AppSettings["consumeTaxRate"]);
			// Create an instance from EventLog
			if(EventLog.SourceExists(strLog,strMachine))
			{
				daEventLog = new EventLog(strLog,strMachine,strSource);
			}
		}

		/// <summary>
		/// Writes error messages in to the EventLog
		/// </summary>
		/// <param name="strMessage"></param>
	    protected virtual void ErrorLog(string strMessage)
		{
			// write in Windows EventLog
			if(daEventLog!=null)
			{
				daEventLog.WriteEntry(strMessage,EventLogEntryType.Error);
			}
			// throw an error to the buisness access tier
			Exception oException= new Exception("An error occured in  BLTier ");
			throw oException;
		}

		/// <summary>
		///  Writes error messages in to the EventLog
		/// </summary>
		/// <param name="strMessage"></param>
		/// <param name="oException"></param>
		protected virtual void ErrorLog(string strMessage,Exception oException)
		{
			// write in Windows EventLog
			if(daEventLog!=null)
			{
				string oMessage = oException.Message + " " + strMessage;
				daEventLog.WriteEntry(oMessage,EventLogEntryType.Error);
			}
			// throw an error to the 
			Exception oExcept= new Exception("An error occured in  BLTier");
			throw oExcept;
		}
       

		/// <summary>
		/// Writes warning messages on the EventLog
		/// </summary>
		/// <param name="strMessage"></param>
		protected void WarningLog(string strMessage)
		{
			// write in Windows EventLog
			if(daEventLog!=null)
			{
				daEventLog.WriteEntry(strMessage,EventLogEntryType.Warning);
			}
		}
	}
}

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 has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

Share

About the Author

Paul Abarham

Switzerland Switzerland
Paul Abraham is a software developer who designs and develops multi-shop systems.
 
He has received his M.Sc in Mathematics and Computer Science from the FernUniversität Hagen(http://www.fernuni-hagen.de Germany) and his main interests are neural networks and bayesian statistics He lives in Rosenheim (South Germany http://www.rosenheim.de). You can reach him at admin@paul-abraham.com.
 

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.141216.1 | Last Updated 4 Feb 2003
Article Copyright 2003 by Paul Abarham
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid