tags:

views:

12

answers:

1

Hello,

I'm using EnterpriseLibrary and DbCommand from it. I have two methods which from database gets same formated select. So the DataReader looks same but I'm executing other procedures.

Question is if good idea is move to one method executing DbCommand and data reading from DataReader like this:

public Dictionary<Guid,List<string>> GetCurrentLoginData()
{
   // here is maked command and private method is called
}
public Dictionary<Guid,List<string>> GetSpecificLoginData(string login)
{
   // here is maked command and private method is called
}

// method which is called from both public methods
private Dictionary<Guid,List<string>> GetLoginData(DbCommand command)
{
   // here is code to executeCommand and data reading
}

or maybe somebody has other idea ? My other way is move only data reading to other method.

Thank's for answers I hope this will help me.

A: 

I don't see anything bad with this approach. You are moving common functionality into the GetLoginData method, which is good practice, and the public methods have meaningful names and proper signatures.

Konamiman
Ok, but if I would change this signature and insert to this private method DataReader and return type with be the same then You will say that's ok too ?? And it's too good practice?
JS Future Software