Report from DbSet BusinessObjects
Report from DbSet BusinessObjects
I'm trying to bind a report directly to a dbset but Entity Framework is not allowing me to do so.
What I would like to achieve is to provide all my EF dbsets as business objects in a report and then do all the filtering and quering using report filters / variables when needed so that the underlying SQL queries get built from the report.
The problem is that EF will not allow data-binding directly to dbset without calling ToList() or Local first
Here is why: http://stackoverflow.com/a/13909122
This answer is quite logical when using data bound to user-interactive controls like editboxes and comboboxes.
In a report however this answer doesn't make sense since most data is read-only and there won't be any user interaction that alters the query after the report is rendered.
Do you know of any workarounds for my problem?
What I would like to achieve is to provide all my EF dbsets as business objects in a report and then do all the filtering and quering using report filters / variables when needed so that the underlying SQL queries get built from the report.
The problem is that EF will not allow data-binding directly to dbset without calling ToList() or Local first
Here is why: http://stackoverflow.com/a/13909122
This answer is quite logical when using data bound to user-interactive controls like editboxes and comboboxes.
In a report however this answer doesn't make sense since most data is read-only and there won't be any user interaction that alters the query after the report is rendered.
Do you know of any workarounds for my problem?
Re: Report from DbSet BusinessObjects
Hello,
Sorry, maybe we did not exactly understand your problem. Could you explain your issue in more details?
Thank you.
Sorry, maybe we did not exactly understand your problem. Could you explain your issue in more details?
Thank you.
Re: Report from DbSet BusinessObjects
I'm registering my EF5 Code First DbSets as Business Objects in a stimulsoft report and then use them in it
On report.Render(); I get an exception:
If I pass DbSet.ToList() as the business object instead of my actual DbSet then everything works fine but I don't want to do that
On report.Render(); I get an exception:
Code: Select all
Data binding directly to a store query (DbSet, DbQuery, DbSqlQuery) is not supported. Instead populate a DbSet with data, for example by calling Load on the DbSet, and then bind to local data. For WPF bind to DbSet.Local. For WinForms bind to DbSet.Local.ToBindingList().
Re: Report from DbSet BusinessObjects
Hello,
This exception is Entity Framework, not our. Please use the DbSet.ToList() for passing.
Thank you.
This exception is Entity Framework, not our. Please use the DbSet.ToList() for passing.
Thank you.
Re: Report from DbSet BusinessObjects
If I use dbset.ToList() my whole table (3.000.000 records) will get retrieved locally and passed to the report.
So I need to perform all my filtering manually before the report gets rendered.
You can't find any workaround for this so that the report filters get applied to the IQueryable?
Probably a parameter to call ToList() yourself after all the filters get applied and before rendering the report?
So I need to perform all my filtering manually before the report gets rendered.
You can't find any workaround for this so that the report filters get applied to the IQueryable?
Probably a parameter to call ToList() yourself after all the filters get applied and before rendering the report?
Re: Report from DbSet BusinessObjects
Hello,
For SQL queries we have the option (FilterEngine=SQLQuery), which allows you to convert the conditions in a query for filtering. But for the business objects it is very hard to implement and a time-consuming task. So we do not even have plans to implement it. Please filter the data before rendering the report.
Thank you.
For SQL queries we have the option (FilterEngine=SQLQuery), which allows you to convert the conditions in a query for filtering. But for the business objects it is very hard to implement and a time-consuming task. So we do not even have plans to implement it. Please filter the data before rendering the report.
Thank you.
Re: Report from DbSet BusinessObjects
But why create your own logic for filtering business objects when I can use Linq to filter those and let entity framework automatically transform the linq into SQL by the entity framework?
In other words you should implement better entity framework integration. There's no point in integrating entity framework if I'm going to run SQL queries to bring and filter the data on the reporting engine. You should support linq to entities!
In other words you should implement better entity framework integration. There's no point in integrating entity framework if I'm going to run SQL queries to bring and filter the data on the reporting engine. You should support linq to entities!
Re: Report from DbSet BusinessObjects
Hello,
It is very hard to implement and a time-consuming task. So we do not even have plans to implement it. Please filter the data before rendering the report.
Sorry.
It is very hard to implement and a time-consuming task. So we do not even have plans to implement it. Please filter the data before rendering the report.
Sorry.