or
public
partial
class
Report1 : Telerik.Reporting.Report
{
public
Report1()
{
//InitializeComponent(); //Not used, as not using Designer...right??
//Set up the datasource:
Telerik.Reporting.SqlDataSource sqlDataSource =
new
Telerik.Reporting.SqlDataSource();
sqlDataSource.ProviderName =
"System.Data.SqlClient"
;
sqlDataSource.ConnectionString =
"Data Source=..."
;
sqlDataSource.SelectCommand =
"SELECT..."
;
//Instantiate report:
var report =
new
Telerik.Reporting.Report();
report.Name =
"theReport"
; //What other properties must I set??
//Set the data item's DataSource property to the SQL datasource:
report.DataSource = sqlDataSource;
//Some parameters:
sqlDataSource.Parameters.Add(
"@Fields.Name"
, System.Data.DbType.String,
"Blade"
);
//Export to PDF:
exportToPDF(report);
}I've downloaded the latest (v6.2) trial version of Telerik Reporting but cannot figure out how to hook it up to my Entity Framework model.
I've added an EntityDataSource
to the designer but this requires a typeof(ObjectContext)
which I don't have.
Looking at the example code from the Telerik website it appears I might be able to cast from DbContext to ObjectContext at runtime but this does not (that I can see) enable me to build a report at design time.
Is it possible to get Telerik Reporting to work with Entity Framework 5?
public class NewReportModel
{
public string ReprotTitle { get; set; }
public List<
Product
> Products { get; set; }
public double ReportSum { get; set; }
}
public class Product
{
public string Name { get; set; }
public double Price { get; set; }
}