t4mvc

T4MVC 3.7.4 doesn't work in VS 2013 (in VS 2012 it is working just fine)

馋奶兔 提交于 2019-12-12 14:43:22
问题 I created a new ASP.NET MVC Web Application project in VS 2013 and installed T4MVC package via nuget. I'm receiving this error below when I am trying to Run Custom Tool for T4MVC.tt in the action menu. Line 792 in T4MVC.tt looks like this: if (method.Type.TypeKind != vsCMTypeRef.vsCMTypeRefCodeType || !(method.Type.CodeType is CodeClass2)) continue; Error 1 Running transformation: System.Runtime.InteropServices.COMException (0x80004005): Unspecified error (Exception from HRESULT: 0x80004005

T4MVC ArgumentOutOfRangeException in View

匆匆过客 提交于 2019-12-12 01:16:36
问题 I just installed T4MVC on my project and I run into some problem. In my controller i can call redirect to action without problem: return RedirectToAction(Actions.Index()); If i do call it from my view, i get an ArgumentOutOfRangeException. @Html.ActionLink("Delete Dinner", MVC.Home.Index()) To make sure I did it correctly, i created a new MVC solution and that line works. I removed from my HomeController my 'baseController' inheritance and resintalled T4MVC to be sure it wouldn't interfere. I

T4MVC Actions token

别说谁变了你拦得住时间么 提交于 2019-12-11 10:17:32
问题 Actions token was removed from T4MVC. So do I understand right there is no short syntax for referencing Action inside the same Controller? 回答1: UPDATE (12/24/2011): My bad, I wasn't thinking straight and came up the incorrect conclusion that it was obsolete, per What is the difference between these 2 definitions in T4Mvc?. While it's not needed when referring to actions from the view, it makes a nice shortcut from within the controller itself, which is why I had added that token in the first

T4MVC and testing with MvcContrib.TestHelpers getting 'The relative virtual path' errors

不打扰是莪最后的温柔 提交于 2019-12-11 02:59:30
问题 My issues my be due to my n00bness in the MVC land, but I'm trying to write a test for a function in a controller that was generated with T4MVC. So I thought I'd use the MvcContrib.TestHelper as well. I new up a TestControllerBuilder and my controller, when I try and call InitializeController on it I get an exception: System.TypeInitializationException: The type initializer for 'Images' threw an exception. ---> System.Web.HttpException: The application relative virtual path '~/Content/Images

T4MVC OptionalParameter values implied from current context

假装没事ソ 提交于 2019-12-10 13:41:41
问题 I've noticed what I believe to be some odd behavior with T4MVC. Specifically, I'm attempting to build an ActionLink (using the HtmlHelper) for an action where the optional parameter value is null. This works fine most of the time. However, if the current route is of the same for which the ActionLink is being built AND the OptionalParameter has a non-null value, the resulting ActionLink will specify the value of the optional parameter from the current route context. That's a wordy explanation,

T4MVC Html.ActionLink or Html.RouteLink - how to add target

一曲冷凌霜 提交于 2019-12-10 10:05:39
问题 I have a working Html.RouteLink that I want to convert to T4MVC. The working RouteLink code is as follows: <%= Html.RouteLink(vaultViewItem.NameDisplay, new {controller = "Entity", action= "Index", dataType = vaultViewItem.VaultID}, new { target="vaultIFrame"}) %> Converting the RouteLink directly does not work at all - the resultant URL contains the RouteValueDictionary class name, rather than the individual dictionary items. I have tried to use the Html.ActionLink with T4MVC and the link

Visual Studio macro to navigate to T4MVC link

余生长醉 提交于 2019-12-07 12:54:43
问题 I use T4MVC and I'm happy with it and want to keep it - it keeps down run time defects. Unfortunately, it makes it harder to navigate to views and content (a.k.a. Views and Links in T4MVC) though. Even using Resharper, I can't navigate to the referenced item: T4MVC and Resharper Navigation Can I get a hand building a macro to do this? Never having built a VS IDE macro before, I don't have a grasp on how to get at some things, like the internal results of the "Go To Definition" process, if

T4MVC and duplicate controller names in different areas

南楼画角 提交于 2019-12-07 05:42:08
问题 In my application I have controller named Snippets both in default area (in application root) and in my area called Manage . I use T4MVC and custom routes, like this: routes.MapRoute( "Feed", "feed/", MVC.Snippets.Rss() ); And I get this error: Multiple types were found that match the controller named 'snippets'. This can happen if the route that services this request ('{controller}/{action}/{id}/') does not specify namespaces to search for a controller that matches the request. If this is

ASP.NET MVC3 How to reference views directly from controller

柔情痞子 提交于 2019-12-07 04:11:36
问题 In my controller I want to specify a different View than default. Like this : public ActionResult EditSurvey(Int32 id) { Survey survey = _entities.Surveys.Single(s => s.Id == id); return View("Survey",survey); } But instead of specifying the view as a string ("Survey") I would like to reference it directly, so if I decide to change the name of my view later on I don't have to change this string manually. So I'm looking for something like this : public ActionResult EditSurvey(Int32 id) {

How to redirect MVC action without returning 301? (using MVC 4 beta)

与世无争的帅哥 提交于 2019-12-07 01:13:35
问题 I'm working on an ASP.NET MVC solution that has a number of different menus. The menu to display depends on the role of the currently logged in user. In MVC 3 I had some custom code to support this scenario, by having a single controller method that would return the right menu. It would do this by deferring the request to the appropriate controller and action depending on the current user. This code appears to be broken in MVC 4 and I'm looking for help to fix it. First, I added a