-1

I have what I think is a very simple use case for DapperExtensions:

using (IDbConnection connection = Database.CreateConnection())
{
    var model = connection.GetList<MyModelPoco>().ToList();
}

However, an exception is thrown:

Method not found: 'System.Collections.Generic.IEnumerable1<System.__Canon> Dapper.SqlMapper.Query(System.Data.IDbConnection, System.String, System.Object, System.Data.IDbTransaction, Boolean, System.Nullable1, System.Nullable`1)'.

I'm using NuGet for both Dapper (v1.13) and DapperExtensions (v1.4.3).

Any ideas why this is not working? I added:

using Dapper;

However, that does not affect the outcome. (Resharper also complains that the using directive is not necessary.)

Dapper is working fine when I use it directly (although I notice I'm using it differently than DapperExtensions):

using (IDbConnection connection = Database.CreateConnection())
{
    var recordsets = connection.QueryMultiple("stored_procedure_name", new {parameterValue}, commandType:CommandType.StoredProcedure);
    var model1 = recordsets.Read<Model1Poco>().SingleOrDefault();

    if (model1 == null) return null;

    model1.Model2Collection = recordsets.Read<Model2Poco>().ToList();

    return model1;
}

I did some "Googling" and it seems that the consensus is that DapperExtensions should be a drop-in and have-fun sort of thing.

klashar
  • 2,519
  • 2
  • 28
  • 38
p07r0457
  • 236
  • 2
  • 11

1 Answers1

2

So it turns out that one of the projects in my solution had an old copy of the Dapper dll. Even though I was using the latest version of Dapper (from NuGet) within my project, the dll being deployed during build must have been the old one.

After updating ALL project references to use the latest NuGet packages, things are working.

p07r0457
  • 236
  • 2
  • 11