T4MVC和Resharper导航 [英] T4MVC and Resharper Navigation

查看:105
本文介绍了T4MVC和Resharper导航的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我经常使用Resharper的转到声明"(Resharper默认键映射中的ctrl + b)键盘快捷键来帮助在VS2010中导航.在我的应用程序中包含对T4MVC的引用之前,我将使用字符串引用",Resharper会知道我要去哪里.

I frequently use Resharper's 'Go to Declaration' (ctrl + b in the Resharper Default Keymapping) keyboard shortcut to help with navigation within VS2010. Before I included a reference to T4MVC in my application, I would use "string refrences" and Resharper would know where I 'meant' to go.

例如:

@Html.Partial("_Continents" )

当我在字符串"_Continents"上使用ctrl + b时,Resharper知道我想转到名为_Continents.cshtml的局部视图.

When I would use ctrl+b on the string "_Continents", Resharper knew I wanted to go to the partial view named _Continents.cshtml.

由于我已经开始使用T4MVC,因此可以编写与上面相同的代码段:

Since I have started using T4MVC, the same snippet above could be written:

@Html.Partial( MVC.CascadingDropDownLists.DropDownAjaxPost.Views._Continents )

当我在_Continents上使用ctrl + b时,不是将我带到部分视图,而是带我到T4MVC生成的代码.

When I use ctrl+b on _Continents, instead of taking me to the partial view, it takes me to the T4MVC generated code.

在恢复原始导航的同时,有什么方法可以将T4MVC保留在项目中(我真的是像强类型感觉和智力支持)吗?

Is there any way to keep T4MVC in the project (I really like the strongly typed feel and intellisense support), while restoring the original navigation?

推荐答案

不幸的是,ReSharper的MVC导航仅在常量上起作用. 如果T4MVC将生成const而不是只读字段-应该可以.

Unfortunately, ReSharper's MVC navigation works only on constants. If T4MVC will generate consts instead of readonly fields - it should works.

这篇关于T4MVC和Resharper导航的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆