小编Rog*_*ger的帖子

在使用子对象列表读取对象时,需要无参数的默认构造函数来允许dapper实现错误

我有这个:

public class object_a
{
    public int ta_Id { get; set; }
    public string ta_Label { get; set; }
    public IEnumerable<table_c> SomeName { get; set; }
}

public class table_b
{
    public int Id {get;set;}
    public int SomeId {get;set;}
    public int FK_A {get;set;}
}

public class table_c
{
    public int Id {get;set;}
    public int Max {get;set;}
    public string Label {get;set;}
    public int FK_A {get;set;}
}
Run Code Online (Sandbox Code Playgroud)

使用Dapper我检索object_a包含任意数量子对象的列表table_c

using (System.Data.SqlClient.SqlConnection sqlConnection = new System.Data.SqlClient.SqlConnection(_con))
{
        sqlConnection.Open();
        var sql = …
Run Code Online (Sandbox Code Playgroud)

c# asp.net-mvc-3 dapper

1
推荐指数
1
解决办法
7139
查看次数

标签 统计

asp.net-mvc-3 ×1

c# ×1

dapper ×1