开发者

MVC 3 and strongly-typed views

开发者 https://www.devze.com 2023-02-08 23:40 出处:网络
I have been having multiple problems with getting the Add View.. “Create a strongly-typed vie开发者_如何学编程w” dialog box option to work properly.

I have been having multiple problems with getting the Add View.. “Create a strongly-typed vie开发者_如何学编程w” dialog box option to work properly.

Most of the time, I am unable to get the Model classes to show up in the “Model Class” drop down. This last issue is with Entity Framework classes that have been generated within the Model folder (and namespace). I Rebuild the project and they still fail to show up.

In fact, if I add a test class to the Model folder with a few public properties—it is not showing up in the drop down.

Is their any information available on how this drop down pulls the Model classes to display to the end-user?

Regards,


Normally rebuilding the project should be enough to show your custom class. But unfortunately this is far from perfect. Happens to me also. What I do is that I create my view model (not entity framework model because you should be passing only view models to your views), copy the name into the clipboard and paste it in the Add View dialog. I find this faster than scrolling through a dropdown of 1000 classes and finding the correct one.

0

精彩评论

暂无评论...
验证码 换一张
取 消