开发者

Crystal Reports & EF CodeFirst relations

Note: I'm new to Crystal reports, as I'd always used ActiveReports at previous jobs, however my current customer is insisting on Crystal.

I am wanting to do a basic report listing data from multiple EF CodeFirst entities. I can make an IEnumerable of my data that I need by doing the following:

var data = from r in _db.Registrations
                       select new AdminReportViewModel
                                  {
                                      Presentation1 = r.Presentation1.Name,
                                      Presentation2 = r.Presentation2.Name,
                                      Presentation3 = r.Presentation3.Name,
                                      Presentation4 = r.Presentation4.Name,
                                      StudentName = r.Student.FullName,
                                      StudentSession = r.Student.Session.ToString(),
                                      TeacherName = r.Student.Teacher.FullName
                                  };

Howe开发者_JAVA技巧ver, I can not seem to bind this AdminReportViewModel object to a report like I can with a Registration object. It asks me for an xml schema file. However, if I bind a Registration object, I can only get the StudentId, not the related Student entity.

Is there a better way to do this, to bind the report to all my Registration objects, and load the object's related entities into labels?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜