I'm with the follow question: I have a method that returns a SqlDataReader, then I do a While in this SqlDataReader as you see bellow:
using (SqlDataReader objSqlDtReader = objDtAccess.GetDataReader())
{
while(objSqlDtReader.Read())
{
UserEntitie objUserEntitie = new UserEntitie();
objUserEntitie.Name = Convert.ToString(objSqlDtReader["name"])
}
}
So, I need to fill all my UserEntite with all data, Name, Email, Id. But I have many methods in User Class as (GetUserById, GetUserByEmai, GetAllUsers), and I have to fill a data again.
I need to create an private method that fill my UserEntitie and in each method I only call my method FillUser and return its. I think that I need to pass my SqlDataReader to my private method FillUser.
Any suggestions to do this?