이 예외가 발생하는 이유는 무엇입니까? 코드는 동일하지 않지만 '데모'와 유사합니다. 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();
}
}
}
우리도 똑같은 문제가 있었고 솔루션의 일부 프로젝트가 다른 버전의 Dapper를 참조하고있는 것으로 나타났습니다. 예를 들어, 한 프로젝트에서 속성 창에 v4.0.30319가 표시된 런타임 버전이 사용되었습니다. 다른 프로젝트에는 v2.0.50727 (.NET 3.5)의 Dapper 런타임 버전이 있습니다.
v2.0.50727 버전으로 모두 설정하자마자이 오류가 사라졌습니다.
* 두 파일 버전 모두 파일 버전 1.12.0.0을 보여 주므로주의해야합니다.