I'm wondering if any of you use static nested classes? Any opinions or drawbacks?
Here's an example...
Usage:Code:public class Constants { internal static class DB { public static class Params { public const string Address1 = "Address1"; public const string City = "City"; public class Scheduler { public const string Active = "Active"; public const string DepartmentID = "DepartmentID"; } } public static class Sprocs { public static class Employee { public const string Create = "[dbo].[Employee.Create]"; public const string Delete = "[dbo].[Employee.Delete]"; public const string Get = "[dbo].[Employee.Get]"; public const string GetList = "[dbo].[Employee.GetList]"; } } public static class Connections { public static string Facilitator { get { return ConfigurationManager.ConnectionStrings[ "Facilitator" ].ConnectionString; } } } } }
Code:publicEmployee[ ] GetEmployees( Guid companyID, bool includeInactive ) { List<Employee> list = newList<Employee>( ); using( DAL dal = DAL.Create( Constants.DB.Connections.Facilitator ) ) { dal.Open( ); SqlParamCollection sqlParams = SqlParamCollection.Create( ); sqlParams.Add( Constants.DB.Params.CompanyID, companyID ); sqlParams.Add( Constants.DB.Params.IncludeInactive, includeInactive ); using( SafeDataReader dr = SafeDataReader.Create( dal.ExecuteReader( Constants.DB.Sprocs.Employee.GetList, sqlParams ) ) ) { while( dr.Read( ) ) { list.Add( EmployeeCreator.Create( dr ) ); } } } return list.ToArray( ); }
Comments?
[/SIZE]




Reply With Quote