简体   繁体   English

Microsoft Report在VS2013和MVC / Web API项目中不起作用

[英]Microsoft Report does not work in VS2013 and MVC/Web API project

I am using VS2013 and I am creating a really simple application in MVC. 我正在使用VS2013,并且正在MVC中创建一个非常简单的应用程序。 I have to create a report, so I thought to use the reports included in VS2013. 我必须创建一个报告,因此我想使用VS2013中包含的报告。 I would like to use the classes of my model to create the report. 我想使用模型的类来创建报告。 But for a strange I do not see those classes. 但是奇怪的是,我没有看到那些课程。 At the start I could attach my report just to the database, so I looked for a solution on internet. 开始时,我可以将报告仅附加到数据库,因此我在互联网上寻找解决方案。 I have found this: 我发现了这一点:

Can't see or add Website Data Sources in RDLC report in ASP.NET MVC 在ASP.NET MVC中无法在RDLC报表中查看或添加网站数据源

Unfortunatelly, this do not solve my problem... Now, I can see some namespaces in choosing the datasource, but I do not see my Model. 不幸的是,这不能解决我的问题...现在,在选择数据源时可以看到一些名称空间,但是看不到我的模型。 Following a class of my model: 遵循我的模型课程:

namespace Export.Microsoft.Reports.Models
{
    public class OrderModel
    {
        public Company Sender { get; set; }
        public Company Receiver { get; set; }
        public Company Other { get; set; }
        ...
    }
}

And following is what I see when I try to select a class of my model: 以下是当我尝试选择模型的类时看到的内容:

在此处输入图片说明

How can I solve? 我该如何解决? Thanx 谢谢

Resolved, In my model I need to write some code to retrieve data. 解决,在我的模型中,我需要编写一些代码来检索数据。

For example: 例如:

namespace Export.Microsoft.Reports.Models
{
    public class OrderModel
    {
        public Company Sender { get; set; }
        public Company Receiver { get; set; }
        public Company Other { get; set; }
        ...

        public OrderModel GetAllOrders()
        {
            ...
        }
    }
}

Only in this way, the model appear in the list and I can select it. 只有这样,模型才会出现在列表中,并且我可以选择它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM