Dynamic Linq - request a schema that is known only at runtime?

I know that with dynamic linq you can dynamically build expressions the same way you can create and execute a dynamic SQL statement - for example. dynamic where clause or dynamic pick list. Is it possible to do this in cases where the circuit is not known at compile time?

In the database I work with, users can define their own objects that create new tables / columns in the internal database. At run time, I will know the names of the tables and columns that I need to work with, but I will not know the schema at compile time, so I cannot build DBML to work in front.

Is there any way to dynamically detect the schema at runtime, or is this the case when I need to stick to building dynamic SQL statements?

+3
source share
1 answer

As far as we understand, you definitely do not know either the name of the circuit or the complete structure of your circuit.
In this case, the strongly typed ExecuteQuery overload method seems to be an option.
Just write SQL queries and add the necessary parameters (for example, the names of tables and columns) either by concatenating rows or as parameters.

+1
source

Source: https://habr.com/ru/post/1770596/


All Articles