0

我有一个东西的实体类:

  public partial class Stuffs
{
    public Stuffs()
    {
        this.Stuffs1 = new HashSet<Stuffs>();
    }

    public long StuffID { get; set; }
    public Nullable<long> StuffParentID { get; set; }
    public string StuffTitle { get; set; }


    public virtual ICollection<Stuffs> Stuffs1 { get; set; }
    public virtual Stuffs Stuffs2 { get; set; }
   }

当我将 List 发送到 stimulereport 时,我想在 master-detail 或 parent-child 中显示结果。

这些是我的刺激代码:

 public ActionResult PrintTreeStuffsResult()
    {
        List<Stuffs> StuffListResult = db.Stuffs.ToList();

        StiReport StiRpt = new StiReport();
        StiRpt = GetStiReportTree(StuffListResult);
        return StiMvcViewerFx.GetReportSnapshotResult(StiRpt);
    }
  public StiReport GetStiReportTree(List<Stuffs> StuffsTreeResult)
    {
        StiReport StiRpt = new StiReport();
        string a = HttpContext.Server.MapPath("~/Content/Reports/Admin/StuffsTreeResult.mrt");
        StiRpt.Load(a);
     StiRpt.RegBusinessObject("Stuffs", StuffsTreeResult);

        StiRpt.Dictionary.SynchronizeBusinessObjects();
        StiRpt.Save(HttpContext.Server.MapPath("~/Content/Reports/Admin/StuffsTreeResult.mrt"));
        return StiRpt;
    }

我在互联网上看到了许多示例,这些示例解释了两个具有关系的表,例如客户和订单。但我有一张自加入的桌子。我怎样才能做到这一点?谢谢...

4

1 回答 1

0

尝试使用下一个方法:

StiRpt.Dictionary.SynchronizeBusinessObjects(2);
于 2014-09-02T08:39:27.480 回答