我已经在我的Dapper ORM上设置了以下复杂模型,但它不会持久化:
const string sqlQuery = "INSERT INTO Reports (created_at, post_name) VALUES (@CreatedAt, @PostData.PostName)";
_connection.Execute(sqlQuery, report);
namespace Foobar.Models
{
public class Report
{
public int Id { get; set; }
public DateTime CreatedAt { get; set; }
public PostData PostData { get; set; }
}
public class PostData
{
public string title { get; set; }
public double index { get; set; }
}
}
我遇到了以下错误:
The member PostData of type Foobar.Models.PostData cannot be used as a parameter value