This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public IEnumerable<Cliente> BuscarClientes() | |
{ | |
var query = "SELECT TOP 100000 * FROM Cliente"; | |
var lstCliente = new List<Cliente>(100000); | |
var cmd = new SqlCommand(query, _connection); | |
using (var reader = cmd.ExecuteReader()) | |
{ | |
if (reader.HasRows) | |
{ | |
while (reader.Read()) | |
lstCliente.Add(new Cliente | |
{ | |
Id = (int)reader["Id"], | |
Nome = reader["Nome"].ToString(), | |
DataNascimento = (DateTime)reader["DataNascimento"], | |
ClienteEspecial = (bool)reader["ClienteEspecial"], | |
NomeDaMae = reader["NomeDaMae"].ToString(), | |
QuantidadeFilhos = (byte)reader["QuantidadeFilhos"] | |
}); | |
} | |
} | |
return lstCliente; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment