我有表用户
CREATE TABLE [User](
[Id] [int] primary key NOT NULL,
[Username] [nvarchar](50) NULL,
[EmailID] [nvarchar](50) NULL)
用户类
public class User
{
public int Id { get; set; }
public string Username { get; set; }
public string EmailID { get; set; }
}
代码
var usr=new User();
usr.Id=1;
usr.Username="jhon";
usr.EmailID="j@gmail.com";
_dbConnection.Insert<User>(usr);
上面的代码抛出空异常。具有身份的表工作正常。
堆栈跟踪:
在 Dapper.SimpleCRUD.Insert[TKey](IDbConnection 连接,对象 entityToInsert,IDbTransaction 事务,Nullable`1 commandTimeout)
错误信息:
Dapper.SimpleCRUD.dll 中出现“System.Exception”类型的异常,但未在用户代码中处理附加信息:无效的返回类型