|
///////////////////////////////////////////////////////////////////////////
// Copyright 2003-2005 Falcon Soon
//
// Author: Soon Chun Boon
// Date: 31 August 2004
// Modified Date: 25 May 2006
// Description:
// Provides Exception classes that is related to database operation.
///////////////////////////////////////////////////////////////////////////
using System.Data;
using Microsoft.ApplicationBlocks.ExceptionManagement;
namespace DBHelper.DataException
{
/// <summary>
/// Exception that describes the Collection instance does not contain
/// the TableHelper with the specified table name.
/// </summary>
public class TableHelperNotInTheCollection : BaseApplicationException
{
/// <summary>
/// Initialize a new instance of <see cref="DBHelper.DataException.TableHelperNotInTheCollection"/>
/// class with the specified table name (Table name for the TableHelper).
/// </summary>
/// <param name="strTableName">The table name.</param>
public TableHelperNotInTheCollection(string strTableName) :
base("Table name " + strTableName + " is not in the collection.")
{
}
}
/// <summary>
/// Exception that describes the provided index is out of DataSetHelper
/// instance range.
/// </summary>
public class TableHelperOutOfRange : BaseApplicationException
{
#region Class Member Declarations
private int miIndex;
#endregion
/// <summary>
/// Initialize a new instance of <see cref="DBHelper.DataException.TableHelperOutOfRange"/>
/// class with the specified index.
/// </summary>
/// <param name="iIndex">The index.</param>
public TableHelperOutOfRange(int iIndex) :
base("Index " + iIndex.ToString() + " is out of range in DataSetHelper.")
{
miIndex = iIndex;
}
#region Class Property Declarations
/// <summary>
/// Gets the out of range index.
/// </summary>
public int Index
{
get
{
return (miIndex);
}
}
#endregion
}
/// <summary>
/// Exception that describes 2 or more than 2 instance is found for the same name
/// with case insensitive comparison.
/// </summary>
public class CaseInsensitiveNameConflict : BaseApplicationException
{
/// <summary>
/// Initialize a new instance of <see cref="DBHelper.DataException.CaseInsensitiveNameConflict"/>
/// class with the specified case insensitive conflict name.
/// </summary>
/// <param name="strTableName">The case insensitive conflict name.</param>
public CaseInsensitiveNameConflict(string strTableName) :
base("Name - " + strTableName + " is case insensitive conflict.")
{
}
}
/// <summary>
/// Exception that describes primary key or unique key constraint is not available
/// in a TableHelper instance.
/// </summary>
public class NoPrimaryOrUniqueKeyAvailable : BaseApplicationException
{
/// <summary>
/// Initialize a new instance of <see cref="DBHelper.DataException.NoPrimaryOrUniqueKeyAvailable"/>
/// class.
/// </summary>
public NoPrimaryOrUniqueKeyAvailable() : base()
{
}
}
/// <summary>
/// Exception that describes fields is not available for the specified table name.
/// </summary>
public class NoFieldsAvailable : BaseApplicationException
{
/// <summary>
/// Initialize a new instance of <see cref="DBHelper.DataException.NoFieldsAvailable"/>
/// class with the specified table name.
/// </summary>
/// <param name="strTableName">The table name.</param>
public NoFieldsAvailable(string strTableName) :
base("No fields is available for table " + strTableName + ".")
{
}
}
/// <summary>
/// Exception that describes the specified parent relationship is already exist
/// for the TableHelper instance.
/// </summary>
public class ParentRelationAlreadyExist : BaseApplicationException
{
/// <summary>
/// Initialize a new instance of <see cref="DBHelper.DataException.ParentRelationAlreadyExist"/>
/// class.
/// </summary>
public ParentRelationAlreadyExist() : base()
{
}
}
/// <summary>
/// Exception that describes the specified foreign relationship is already exist
/// for the TableHelper instance.
/// </summary>
public class ForeignRelationAlreadyExist : BaseApplicationException
{
/// <summary>
/// Initialize a new instance of <see cref="DBHelper.DataException.ForeignRelationAlreadyExist"/>
/// class.
/// </summary>
public ForeignRelationAlreadyExist() : base()
{
}
}
/// <summary>
/// Exception that describes length between 2 <see cref="DBHelper.DBKey"/> instances is different.
/// </summary>
public class KeyLengthMismatch : BaseApplicationException
{
/// <summary>
/// Initialize a new instance of <see cref="DBHelper.DataException.KeyLengthMismatch"/>
/// class.
/// </summary>
public KeyLengthMismatch() : base()
{
}
}
/// <summary>
/// Exception that describes columns between 2 <see cref="DBHelper.DBKey"/> instances is identical.
/// </summary>
public class KeyColumnsIdentical : BaseApplicationException
{
/// <summary>
/// Initialize a new instance of <see cref="DBHelper.DataException.KeyColumnsIdentical"/>
/// class.
/// </summary>
public KeyColumnsIdentical() : base()
{
}
}
/// <summary>
/// Exception that describes columns type between 2 <see cref="DBHelper.DBKey"/> instances is mismatch.
/// </summary>
public class ColumnsTypeMismatch : BaseApplicationException
{
/// <summary>
/// Initialize a new instance of <see cref="DBHelper.DataException.ColumnsTypeMismatch"/>
/// class.
/// </summary>
public ColumnsTypeMismatch() : base()
{
}
}
/// <summary>
/// Exception that describes the column does not belong to any tables.
/// </summary>
public class ColumnNotInAnyTable : BaseApplicationException
{
/// <summary>
/// Initialize a new instance of <see cref="DBHelper.DataException.ColumnNotInAnyTable"/>
/// class.
/// </summary>
public ColumnNotInAnyTable() : base()
{
}
}
/// <summary>
/// Exception that describes columns' tables are mismatch.
/// </summary>
public class KeyTableMismatch : BaseApplicationException
{
/// <summary>
/// Initialize a new instance of <see cref="DBHelper.DataException.KeyTableMismatch"/>
/// class.
/// </summary>
public KeyTableMismatch() : base()
{
}
}
/// <summary>
/// Exception that describes the length of <see cref="DBHelper.DBKey"/> array parameter is zero.
/// </summary>
public class KeyNoColumns : BaseApplicationException
{
/// <summary>
/// Initialize a new instance of <see cref="DBHelper.DataException.KeyNoColumns"/>
/// class.
/// </summary>
public KeyNoColumns() : base()
{
}
}
/// <summary>
/// Exception that describes the database key length is more than the specified.
/// </summary>
public class KeyTooManyColumns : BaseApplicationException
{
/// <summary>
/// Initialize a new instance of <see cref="DBHelper.DataException.KeyTooManyColumns"/>
/// class with the specified key total.
/// </summary>
/// <param name="iTotalKey">The key total.</param>
public KeyTooManyColumns(int iTotalKey) :
base("Key length cannot more than " + iTotalKey.ToString() + ".")
{
}
}
/// <summary>
/// Exception that describes the columns in <see cref="DBHelper.DBKey"/> instance are duplicate.
/// </summary>
public class KeyDuplicateColumns : BaseApplicationException
{
/// <summary>
/// Initialize a new instance of <see cref="DBHelper.DataException.KeyDuplicateColumns"/>
/// class with the duplicate column name.
/// </summary>
/// <param name="strColumnName">The duplicate column name.</param>
public KeyDuplicateColumns(string strColumnName) :
base("Column - " + strColumnName + " is duplicate.")
{
}
}
/// <summary>
/// Exception that describes the provide length of database sort key is different
/// with the specified database key length.
/// </summary>
public class KeySortLength : BaseApplicationException
{
/// <summary>
/// Initialize a new instance of <see cref="DBHelper.DataException.KeySortLength"/>
/// class.
/// </summary>
public KeySortLength() : base()
{
}
}
/// <summary>
/// Exception that describes property is accessed when the object becomes bad.
/// </summary>
public class BadObjectPropertyAccess : BaseApplicationException
{
/// <summary>
/// Initialize a new instance of <see cref="DBHelper.DataException.BadObjectPropertyAccess"/>
/// class with the specified error message.
/// </summary>
/// <param name="strMessage">The error message.</param>
public BadObjectPropertyAccess(string strMessage) :
base(strMessage)
{
}
}
/// <summary>
/// Exception that describes the case sensitivity and locale between parent table and
/// child table is mismatched.
/// </summary>
public class CaseLocaleMismatch : BaseApplicationException
{
/// <summary>
/// Initialize a new instance of <see cref="DBHelper.DataException.CaseLocaleMismatch"/>
/// class.
/// </summary>
public CaseLocaleMismatch() : base()
{
}
}
/// <summary>
/// Exception that describes the specified <see cref="DBHelper.DBRelation"/> instance is not in the collection.
/// </summary>
public class RelationNotInTheCollection : BaseApplicationException
{
/// <summary>
/// Initialize a new instance of <see cref="DBHelper.DataException.RelationNotInTheCollection"/>
/// class with the missing relation name.
/// </summary>
/// <param name="strName">The missing relation name.</param>
public RelationNotInTheCollection(string strName) :
base("Relation " + strName + " is not the collection.")
{
}
}
/// <summary>
/// Exception that describes the provided index is out of <see cref="DBHelper.DBRelationCollection"/>
/// instance range.
/// </summary>
public class RelationOutOfRange : BaseApplicationException
{
#region Class Member Declarations
private int miIndex;
#endregion
/// <summary>
/// Initialize a new instance of <see cref="DBHelper.DataException.RelationOutOfRange"/>
/// class with the out of range index.
/// </summary>
/// <param name="iIndex">The out of range index.</param>
public RelationOutOfRange(int iIndex) :
base("Index " + iIndex.ToString() + " is out of range in DBRelationCollection.")
{
miIndex = iIndex;
}
#region Class Property Declarations
/// <summary>
/// Gets the out of range index.
/// </summary>
public int Index
{
get
{
return (miIndex);
}
}
#endregion
}
/// <summary>
/// Exception that describes null table is passed in for a table relationship.
/// </summary>
public class RelationTableNull : BaseApplicationException
{
/// <summary>
/// Initialize a new instance of <see cref="DBHelper.DataException.RelationTableNull"/>
/// class.
/// </summary>
public RelationTableNull() : base()
{
}
}
/// <summary>
/// Exception that describes the specified relation instance is not exist.
/// </summary>
public class RelationDoesNotExist : BaseApplicationException
{
/// <summary>
/// Initialize a new instance of <see cref="DBHelper.DataException.RelationDoesNotExist"/>
/// class.
/// </summary>
public RelationDoesNotExist() : base()
{
}
}
/// <summary>
/// Exception that describes parent table in a relation is mismatched.
/// </summary>
public class ParentTableMismatch : BaseApplicationException
{
/// <summary>
/// Initialize a new instance of <see cref="DBHelper.DataException.ParentTableMismatch"/>
/// class.
/// </summary>
public ParentTableMismatch() : base()
{
}
}
/// <summary>
/// Exception that describes child table in a relation is mismatched.
/// </summary>
public class ChildTableMismatch : BaseApplicationException
{
/// <summary>
/// Initialize a new instance of <see cref="DBHelper.DataException.ChildTableMismatch"/>
/// class.
/// </summary>
public ChildTableMismatch() : base()
{
}
}
/// <summary>
/// Exception that describes the specified child table instance in <see cref="DBHelper.DBRelation"/>
/// is mismatched with current TableHelper instance.
/// </summary>
public class ParentRowTableMismatch : BaseApplicationException
{
/// <summary>
/// Initialize a new instance of <see cref="DBHelper.DataException.ParentRowTableMismatch"/>
/// class.
/// </summary>
/// <param name="strChildTableName">The child table name in DB relation.</param>
/// <param name="strCurrentTableName">The current TableHepler's table name.</param>
public ParentRowTableMismatch(string strChildTableName, string strCurrentTableName) :
base("Child Table - " + strChildTableName + " is mismatched with Current Table - "
+ strCurrentTableName + ".")
{
}
}
/// <summary>
/// Exception that describes the specified parent table instance in <see cref="DBHelper.DBRelation"/>
/// is mismatched with current TableHelper instance.
/// </summary>
public class RelationForeignTableMismatch : BaseApplicationException
{
/// <summary>
/// Initialize a new instance of <see cref="DBHelper.DataException.RelationForeignTableMismatch"/>
/// class.
/// </summary>
/// <param name="strParentTableName">The parent table name in DB relation.</param>
/// <param name="strCurrentTableName">The current TableHelper's table name.</param>
public RelationForeignTableMismatch(string strParentTableName, string strCurrentTableName) :
base("Parent Table - " + strParentTableName + " is mismatched with Current Table - "
+ strCurrentTableName + ".")
{
}
}
/// <summary>
/// Exception that describes name is duplicate.
/// </summary>
public class DuplicateNameException : BaseApplicationException
{
/// <summary>
/// Initialize a new instance of <see cref="DBHelper.DataException.DuplicateNameException"/>
/// class with the specified error message.
/// </summary>
/// <param name="strErrMsg">The error message.</param>
public DuplicateNameException(string strErrMsg) :
base(strErrMsg)
{
}
}
}
|
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.
Had worked as analyst programmer for 4 years. Now helping in family business but still involved actively in .Net development whenever there is a free time.