Dynamic view of anonymous type missing member issue - MVC3

前端 未结 6 2005
春和景丽
春和景丽 2021-02-06 17:50

I have an MVC3 site that I\'ve setup for testing another site - most of it has been quick and dirty, and so I\'ve not gone to town creating model and view model types for all th

6条回答
  •  伪装坚强ぢ
    2021-02-06 18:35

    Do you know the name of the assembly generated by the build manager? If so, you should be able to apply InternalsVisibleTo in the controller assembly, and it will all work fine.

    EDIT: One possible solution: create a public type extending DynamicObject in the model assembly which proxies any requests for properties down to your anonymous type via reflection. It would be ugly, but I think it should work... effectively making the anonymous types public.

提交回复
热议问题