0
私はentityframeworkにジェネリッククエリビルダを作成したいと思います。次のメソッドにObjectContext.ExecuteStoreQuery<TElement> Method (String, Object[])
ジェネリック型を渡そうとしています。つまり、文字列myTElementNameからTElementを取得するにはどうすればよいですか?
BindingSource mybindingSource = new BindingSource();
mybindingSource.DataSource =
con.ExecuteStoreQuery<**SomeMethod**(MyTypeName)>(
myperfectWorkingSql,
myperfectWorkingSqlsParams
);
文字列MyTypeNameからTElementを取得するにはどうすればよいですか? SomeMethod()関数はどのようにすべきですか?または、どの方法を使うべきですか?
または次のコードもエラーを教えてください。ここで私は間違っていますか?
function fooo (Type t) {
BindingSource mybindingSource = new BindingSource();
mybindingSource.DataSource =
con.ExecuteStoreQuery<t>(
myperfectWorkingSql,
myperfectWorkingSqlsParams
);
}
ERROR: this gives type t or namespace t can not be found !
の可能重複[ジェネリックメソッドを呼び出すためにリフレクションを使用する方法?](http://stackoverflow.com/questions/232535/ジェネリックパラメータとしてタイプを提供するためにリフレクションを使用することができますしかし、ハウツー・ツー・ユース・リフレクション・ツー・コール・ジェネリック方式) – nawfal