なぜこの例外が発生するのですか? コードは同じではありませんが、「デモ」に近い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.Nullable
1, 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();
}
}
}