Search code examples
c#asp.net-mvc-4asp.net-web-apimicrosoft-reporting

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. I have to create a report, so I thought to use the reports included in 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

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:

enter image description here

How can I solve? Thanx


Solution

  • 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.