Advertisement
Guest User

Untitled

a guest
Oct 24th, 2016
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1.  
  2. public IEnumerable<T> FindAll<T>(string @where)
  3. {
  4. string findAll = $"SELECT * FROM {GetTableName(typeof(T))} {@where}";
  5. var collection = new List<T>();
  6. using (this.connection = new SqlConnection(this.connectionString))
  7. {
  8. this.connection.Open();
  9. SqlCommand findAllCommand = new SqlCommand(findAll, this.connection);
  10. SqlDataReader reader = findAllCommand.ExecuteReader();
  11.  
  12. while (reader.Read())
  13. {
  14. var createdObject = this.CreateEntity<T>(reader);
  15. collection.Add(createdObject);
  16. }
  17. return collection;
  18. }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement