Hello
I want to build reports based on ObjectDataSource. As an easy sample, I tried to start with an sample report, based on your video.
In my project, there is a BI-Layer based on EF4/POCO. But when I try to add a Entity Context Object (to populate the List in GetAllProducts()), I get an Error on Report Preview (see Attachment).
using
System;
using
System.Collections.Generic;
using
System.Linq;
using
System.Text;
using
System.ComponentModel;
using
IW_CCFA_GEKO.Model;
namespace
IW_CCFA_GEKO.Report.ReportModels
{
[DataObject]
public
class
Products
{
protected
CCFAGEKOEntities db =
new
CCFAGEKOEntities();
[DataObjectMethod(DataObjectMethodType.Select)]
public
List<Product> GetAllProducts()
{
var products =
new
List<Product>();
products.Add(
new
Product() {Name =
"Produkt 1"
, Color =
"blau"
, ListPrice = 2.55, ProductNumber =
"654-789"
});
products.Add(
new
Product() {Name =
"Produkt 2"
, Color =
"gelb"
, ListPrice = 1.20, ProductNumber =
"345-768"
});
products.Add(
new
Product() {Name =
"Produkt 3"
, Color =
"rot"
, ListPrice = 5.0, ProductNumber =
"56-334"
});
products.Add(
new
Product() {Name =
"Produkt 4"
, Color =
"grĂ¼n"
, ListPrice = 3.9, ProductNumber =
"234-159"
});
return
products;
}
}
}
In the same Project, I made a report, directly based on an EntityDataSource, which works, even in Preview. But I need to do some processing in my own Classes before.
What's wrong and how to resolve it?
Thanks, Simon