Created
August 13, 2019 05:06
-
-
Save gethari/2125154951159dcdb814da80495b83d2 to your computer and use it in GitHub Desktop.
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 async Task<List<KeyValuePair<string, string>>> WithoutDapper(Guid id) | |
{ | |
using (var connection = new SqlConnection(ConnectionString)) | |
{ | |
List<KeyValuePair<string, string>> propertiesList = new List<KeyValuePair<string, string>>(); | |
SqlCommand command = new SqlCommand(queryString, connection); | |
command.Parameters.AddWithValue("Id", id); | |
connection.Open(); | |
SqlDataReader reader = await command.ExecuteReaderAsync(); | |
if (reader.HasRows) | |
{ | |
while (reader.Read()) | |
{ | |
propertiesList.Add(new KeyValuePair<string, string>( | |
reader["Name"].ToString(), | |
reader["Type"].ToString())); | |
} | |
} | |
return propertiesList; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment