SD.LLBLGen.Pro.ORMSupportClasses: 4.2.20160929
SD.LLBLGen.Pro.DQE.SqlServer: 4.2.20160929
.NET Framework 4.6.1
Sql Server 12.0.5207.0 (2012)
Hi,
I need to get some DataTables for some tables, but the thing is that I can't use the strongly typed entities or fields to do the query.
For example, if I know the entity is called CustomerEntity and the table is called Customer with some fields like Id, Name, and so on.
So, I would need to query something like SELECT Id, Name FROM Customer and get a DataTable.
I can't use the CustomerEntity or the fields in the code because this is a dynamic feature of the application so I know the names because they are in a configuration repository.
Something like:
var entityName = "CustomerEntity";
var fieldsToQuery = new string[] {"Id", "Name"};
var dataTable = SomeMethodToGetDataTable(entityName, fieldsToQuery);
I know there is FetchAsDataTable() extension method but I don't know how to create a DynamicQuery without using strongly typed entities and fields. I need to create the query only with names as a string.
I understand this is not a normal use of the library and tried to simplify the example but this is something it is required by the application.
Thanks.