i have a dynamic type
var f = context.ExecuteStoreQuery<dynamic>("CALL iv_sp_computersbyday();
开发者_StackOverflow中文版
how i can now what properties have the dynamic tuype returned??? i cant acces by reflection on the dynamic.
I'm not familiar with ExecuteStoreQuery but there is a difference between using the dynamic keyword and the object actually being a Dynamic Object. If it's a static object that is just cast as dynamic, then reflection will work just fine. If it's a Dynamic Object then reflection will return methods just not the ones you'd be expecting. Generally a Dynamic Object will have some way to query the parameters that are used to handle the implementation, for example things that inherit from DynamicObject
often implement GetDynamicMemberNames
and then has methods to invoke dynamically like TryGetMember
. There are more general ways to do the dynamic binding once you have member names but it can be a little much to use with the DLR CallSites and Binders, although there are some simple static methods that encapsulate all the DLR stuff in the open source framework Impromptu-Interface.
精彩评论