Optimization in Common Decalaration

Posted by Pratik on Stack Overflow See other posts from Stack Overflow or by Pratik
Published on 2010-12-31T11:49:08Z Indexed on 2010/12/31 11:54 UTC
Read the original article Hit count: 236

Its a 3-tier ASP.NET Website Project In Data Layer there is class "Common Decalaration" in which lot of common things are mentioned. Something this way :

public class CommonDeclartion
{

    #region Common Messages

    public const string RECORD_INSERT_MSG = "Record Inserted Successfully ";
    public const string RECORD_UPDATE_MSG = "Record Updated Successfully";
    public const string RECORD_DELETE_MSG = "Record Deleted Successfully";
    public const string ERROR_MSG = "Error Ocuured while Perfoming This Action.";
    public const string UserID_Incorrect = "Please Enter The Correct User ID.";
    public const string RECORD_ALREADY_EXIT = "Record Already Exit";
    public const string NO_RECORD = "No Record found.";

    #endregion

}

Can this be more optimized in terms of :

1.Perfomance
2.Security(if any)
3.Code Readablity or Reusablity

I thought of using enum but can't figure that out :

enum CommonMessages
{
        RECORD_INSERT_MSG  "Record Inserted Successfully.",
        RECORD_UPDATE_MSG  "Record Updated Successfully.",
        RECORD_DELETE_MSG  "Record Deleted Successfully.",
        ERROR_MSG  "Error Ocuured while Perfoming This Action.",
        UserID_Incorrect  "Please Enter The Correct User ID.",
        RECORD_ALREADY_EXIT  "Record Already Exit.",
        NO_RECORD  "No Record found.",
}

or else should keep them in some collections like dictionary/NameValueCollection or so or i have to keep them in XML in form of key/value pair and reterive from it ?

What can be better way keeping in mind
1.Perfomance
2.Security(if any)
3.Code Readablity or Reusablity

© Stack Overflow or respective owner

Related posts about c#

Related posts about ASP.NET