Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public IEnumerable<T> FindAll<T>(string @where)
- {
- string findAll = $"SELECT * FROM {GetTableName(typeof(T))} {@where}";
- var collection = new List<T>();
- using (this.connection = new SqlConnection(this.connectionString))
- {
- this.connection.Open();
- SqlCommand findAllCommand = new SqlCommand(findAll, this.connection);
- SqlDataReader reader = findAllCommand.ExecuteReader();
- while (reader.Read())
- {
- var createdObject = this.CreateEntity<T>(reader);
- collection.Add(createdObject);
- }
- return collection;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement