dapper rainbow MissingMethodException

2 c# dapper dapper-rainbow

为什么我会得到这个例外?代码不一样,但接近'demo'https://gist.github.com/1599013

例外:MissingMethodException

说明:

找不到方法:'System.Collections.Generic.IEnumerable 1<System.Object> Dapper.SqlMapper.Query(System.Data.IDbConnection, System.String, System.Object, System.Data.IDbTransaction, Boolean, System.Nullable1,System.Nullable`1)'.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net.Mail;
using Dapper;
using System.Data.SqlClient;
using MySql.Data.MySqlClient;

namespace daconsole2
{
    class Program
    {
        class Product
        {
            public int Id { get; set; }
            public string Name { get; set; }
            public string Description { get; set; }
            public DateTime? LastPurchase { get; set; }
        }

        // container with all the tables
        class MyDatabase : Database<MyDatabase>
        {
            public Table<Product> Products { get; set; }
        }
        //*/
        static void Main(string[] args)
        {
            var cnn = new MySqlConnection("uid=name;pwd=pw;Port=3306;database=test");
            cnn.Open();
            var db = MyDatabase.Init(cnn, commandTimeout: 2);
            //if(false)
            db.Execute(@"create table Products (
Id int primary key,
Name varchar(20),
Description TEXT,
LastPurchase datetime)");
            var productId = db.Products.Insert(new { Name = "Hello", Description = "Nothing" });
            //var db = cnn;
            Console.ReadKey();
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

Adr*_*arr 12

我们遇到了同样的问题,结果是解决方案中的一些项目引用了不同版本的Dapper.例如,一个项目使用了在"属性"窗口中显示v4.0.30319的运行时版本.另一个项目的Dapper运行时版本为v2.0.50727(.NET 3.5).

一旦我将它们全部设置为v2.0.50727版本,此错误就会消失.

*应该注意的是,它们都显示了文件版本1.12.0.0,因此这不是一种可靠的方式来区分它们.