Export Controller

Hi,
I'm trying to use your export controller and i would like to know if it is possible to pass directly to this controller a parameter which will be a IQueryable datasource ?

Regards.

The parameters of the controllers are query parameters (primitive values) - you cannot pass complex objects as IQueryable.

Hi,
Ok, thanks for your reply.
Regards,

In fact, I am also interested in whether there is a way to accomplish this, since I have the same need: an IQueryable data source with a few calculated values within the code. I am currently seeking a way to export this collection to Excel.

I considered creating a database view and using it with the Excel export, which queries the database directly. However, some of the calculated values are too complex for me to calculate within the SQL view; I must use C# instead.

Hi,
I saw in your sample that exist an ExportNorthwindController and i would like use it.
I also saw that in the constructor of this controller we can pass as parameter a NorthwindContext.
I would like to do the same thing but with a EntityFrameworkCore that we have.
Can you explain me how can i do that and particulary how to call the controller, please ?
Regards,

I’m afraid I cannot provide any additional info since the code is self explanatory. The controller method is executed when you navigate to a url that is handled by the controller:

ok, and i can change the constructor of ExportNorthwindController to pass another EntityFrameWork ?

You can change it in the way you need.

Ok, thanks for your support.
Ragards,

Hi,
It works perfectly.
Regards,