我目前正在构建一个将12个表连接在一起的SELECT查询.我一直在使用Dapper进行所有其他查询,效果很好.问题是,泛型方法只需要五个通用参数.
我之前修改过代码以支持最多6个用于另一个查询,但现在我真的不认为我应该破解6个更多级别的泛型.
有没有办法将dapper传递给一个类型数组,并将结果作为一个对象数组返回,如果必须的话我可以手动编译?
我也可能以错误的方式接近问题!任何帮助将不胜感激!
我需要获取一个复杂的对象数组。
这是我的 2 节课
public class Geometria
{
public int idGeom { get; set; }
public int idMatriz { get; set; }
public string Referencia { get; set; }
public int toleInf { get; set; }
public int toleSup { get; set; }
public ICollection<MedidaX> Medidas { get; set; }
}
public class MedidaX
{
public int IdRegGeo { get; set; }
public float X { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
作为 json 返回时我的预期结果基本上是这样的
{
"Geometrias": [
{
"idGeom": 1,
"idMatriz": …
Run Code Online (Sandbox Code Playgroud)