0

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

Fredrik Eder
  • 351
  • 3
  • 8
ghanshyam.mirani
  • 3,075
  • 11
  • 45
  • 85

1 Answers1

1

Try this:

// change typelist index as needed 
Type xpQueryGenericType = typeof (XPQuery<>).MakeGenericType(typelist[0]);
var xpQueryInstance = Activator.CreateInstance(xpQueryGenericType, new object[]{xpoSession});
Filip
  • 3,257
  • 2
  • 22
  • 38