Issue related to getting data from persistance class in XPO
-
25-04-2021 - |
Pergunta
I have added persistance classes in my web application using XPO from DevExpress.
Now I want to get data dynamically using XPQuery. Dynamically means: I have got all the class names for particular assembly:
Type[] typelist = typeof(Sample.Students).Assembly.GetTypes();
Now using typelist[2]
, I want to get data from table containing typelist[2].
How can I do it? Tables are listed in typelist
and based on that I have to create XPQuery<> object and then want to get data using LINQ Query:
How can I do it?
Thanks
Solução
Try this:
// change typelist index as needed
Type xpQueryGenericType = typeof (XPQuery<>).MakeGenericType(typelist[0]);
var xpQueryInstance = Activator.CreateInstance(xpQueryGenericType, new object[]{xpoSession});
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow