2012-02-06 2 views
0

DevExpress에서 XPO를 사용하여 웹 응용 프로그램에 지속성 클래스를 추가했습니다.XPO의 지속성 클래스에서 데이터를 가져 오는 것과 관련된 문제

이제 XPQuery를 사용하여 데이터를 동적으로 가져오고 싶습니다. 동적 의미 나는 특정 어셈블리의 모든 클래스 이름을 가지고있다 :

Type[] typelist = typeof(Sample.Students).Assembly.GetTypes(); 

이제 typelist[2]를 사용하여, 나는 typelist을 포함하는 테이블에서 데이터를 얻으려면를 [2].

어떻게하면됩니까? 테이블은 typelist에 나열되어 있으며이를 기반으로 XPQuery <> 개체를 만들고 LINQ 쿼리를 사용하여 데이터를 가져와야합니다. 어떻게해야합니까? 감사

답변

1

이 시도 :

// change typelist index as needed 
Type xpQueryGenericType = typeof (XPQuery<>).MakeGenericType(typelist[0]); 
var xpQueryInstance = Activator.CreateInstance(xpQueryGenericType, new object[]{xpoSession}); 
관련 문제