Is there a way to generate custom sql in linq query for entities?

I have a database where I have a table where columns will be added / removed (we cannot change this behavior, this is legacy).

This table has a foreign key to the table I mapped via EF. I am trying to figure out a way to sort / filter the parent table by one of the dynamic columns using EF.

Can I add a query to a column that doesn't exist before being executed?

My current solution is to get all the records, then get the corresponding records in another (dynamic) table as a dataset and combine them into a new class and sort the list of those objects.

Unfortunately I don't have any code to do this, as my already working solution is not what I want, but I have no idea where to start with the best, optimal solution.

+3


source to share


1 answer


Without some example of how or what you cannot help us. If you won't be dealing with query execution times, then linq is a good solution:



http://www.c-sharpcorner.com/UploadFile/deveshomar/dynamic-linq-library-in-C-Sharp/

0


source







All Articles