HI I've got the following method. It gives the error "Command.ReadList<Product>(ReadProduct) is absolute, use dapper instead. How can I fix this ??
here is my method
- public static List<Product> LoadProducts(SqlConnection connection, SqlTransaction transaction, HostedType? HostedType, Platforms? Platform)
- {
- using (var command = connection.CreateCommand())
- {
- command.Transaction = transaction;
- command.CommandText = "SELECT " + _fields + " FROM Products INNER JOIN ProductGroups " +
- "ON Products.ProductGroupId = ProductGroups.GroupId " +
- "WHERE 1=1 ";
- if (HostedType.HasValue)
- {
- command.CommandText += "AND Products.HostedTypeId = @HostedTypeId OR Products.HostedTypeId IS NULL ";
- command.Parameters.Add("@HostedTypeId", SqlDbType.Int).Value = HostedType.Value;
- }
- if (Platform.HasValue)
- {
- command.CommandText += "And Products.PlatformId = @PlatformId OR Products.PlatformId IS NULL";
- command.Parameters.Add("@PlatformId", SqlDbType.Int).Value = Platform.Value;
- }
- return command.ReadList<Product>(ReadProduct);
- }
- }