Hi All,
I have am working on C# 2.0 for a project and need to know the best
practices for exception handling.
At the moment I am doing it as Follows.
I have a Manager class that is supposed to update entries in the Dictionary
and Database as well, to separate DataBase Layer I have written another
library that contains static methods and does some updating in data base..
The thing I want to know is that is it something that is the right way ? if
not please fuide me with resources...
its like
class PokerTableManager
{
Dictionary<string, PokerTable> PokerTablesDictionary;
public CreateTable(TableInfo info)
{
try
{
PokerTable table = new PokerTable(info);
PokerTablesDictionary.Add("abc",table );
}
}
}
classs PokerTableDAL
{
public static UpdateTable(TableInfo info)
{
try
{
/// SQL Commands here
}
catch(SqlException exp)
{
throw new DataBaseConnectoinException("UNable to connect
to database database",exp)
}
}
public class DataBaseConnectionException : Exception
{
public DataBaseConnectionException()
: base()
{ }
public DataBaseConnectionException(string message)
: base(message)
{ }
public DataBaseConnectionException(string message, Exception inner)
: base(message, inner)
{ }
}
regards
Aftab Alam