I have table User
CREATE TABLE [User](
[Id] [int] primary key NOT NULL,
[Username] [nvarchar](50) NULL,
[EmailID] [nvarchar](50) NULL)
User class
public class User
{
public int Id { get; set; }
public string Username { get; set; }
public string EmailID { get; set; }
}
code
var usr=new User();
usr.Id=1;
usr.Username="jhon";
usr.EmailID="j@gmail.com";
_dbConnection.Insert<User>(usr);
The above code throwing null exception.Table with identity working fine.
Stack Trace:
at Dapper.SimpleCRUD.Insert[TKey](IDbConnection connection, Object entityToInsert, IDbTransaction transaction, Nullable`1 commandTimeout)
Error Message:
An exception of type 'System.Exception' occurred in Dapper.SimpleCRUD.dll but was not handled in user code Additional information: Invalid return type