Currently, in my project I have one class that is dedicated to the all of the queries for the IBM i and converts it into usable models for my .NET code. There is already 12 methods in this class and there will be many, many more to come. This is for a tool that pulls data from our IBM i and pushes it to our internet database server.
Should I split this class up? Should I make it a partial class and put the code across multiple files? Should I do multiple classes?
Just wondering what the best practice is on something like that.
Currently this is the framework I have in place
class IbmIDatabase
{
private DateTime ZERO_DATE = new DateTime(1900, 1, 1, 0, 0, 0);
private string _connString = String.Empty;
SystemCodeRepository scr = new SystemCodeRepository();
/// <summary>
/// Initializes a new instance of the <see cref="IbmIDatabase"/> class.
/// </summary>
public IbmIDatabase()
{
}
#region System Codes
/// <summary>
/// Gets all system codes.
/// </summary>
/// <returns></returns>
public IEnumerable<SystemCode> GetAllSystemCodes()
{
}
#endregion System Codes
#region Citations
/// <summary>
/// Gets all citations.
/// </summary>
/// <returns></returns>
public IEnumerable<ParkingTicket> GetAllCitations()
{
}
#endregion Citations
#region Queue
/// <summary>
/// Gets the queued records.
/// </summary>
/// <returns></returns>
public IEnumerable<QueuedRecord> GetQueuedRecords()
{
}
/// <summary>
/// Marks the queue as processed.
/// </summary>
/// <param name="id">The id.</param>
public void MarkQueueAsProcessed(int id)
{
#endregion Queue
#region Utility Bill Customer
/// <summary>
/// Gets the utility bill customer.
/// </summary>
/// <param name="id">The customer id.</param>
/// <returns></returns>
public Customer GetUtilityBillCustomer(int id)
{
}
/// <summary>
/// Gets the utility bill customer.
/// </summary>
/// <returns></returns>
public IQueryable<Customer> GetUtilityBillCustomer()
{
}
#endregion
#region Utility Bill Details
/// <summary>
/// Gets the customer history.
/// </summary>
/// <param name="id">CustomerId</param>
/// <returns></returns>
public IQueryable<BillHistory> GetCustomerHistory(int id)
{
}
/// <summary>
/// Gets the customer history.
/// </summary>
/// <returns></returns>
public IQueryable<BillHistory> GetCustomerHistory()
{
}
#endregion
#region Utility Bill Payment Details
/// <summary>
/// Gets the customer payment history.
/// </summary>
/// <param name="id">The id.</param>
/// <returns></returns>
public IQueryable<BillPaymentHistory> GetCustomerPaymentHistory(int id)
{
}
/// <summary>
/// Gets the customer payment history.
/// </summary>
/// <returns></returns>
public IQueryable<BillPaymentHistory> GetCustomerPaymentHistory()
{
}
#endregion
#region Utility Bill Summary
/// <summary>
/// Gets the customer summary.
/// </summary>
/// <param name="id">CustomerId</param>
/// <returns></returns>
public IEnumerable<BillSummary> GetCustomerSummary(int id)
{
}
/// <summary>
/// Gets the customer summary.
/// </summary>
/// <returns></returns>
public IQueryable<BillSummary> GetCustomerSummary()
{
}
#endregion
}
Within each method can be quite a few lines of code (up to many 100 or so?). I left one of the longest ones so far in the sample code.