为什么我会得到这个异常?代码不一样,但接近“演示” 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();
        }
    }
}