t4mvc

Make T4MVC work with ASP.NET 5

偶尔善良 提交于 2019-12-07 00:21:40
问题 According to the latest comments in this thread, .tt templates will now after all be supported in ASP.NET 5 starting with Visual Studio Update 1. Which IMHO would be great because after using T4MVC for years, I certainly don't wanna go back to using magic strings for route/view names (error prone and not refactoring-friendly). However, I can't quite get it to work with ASP.NET 5 RC and Visual Studio Professional 2015 Update 1. Here's what I've tried: Adding the T4MVC NuGet (3.16.5) to a blank

Visual Studio macro to navigate to T4MVC link

只谈情不闲聊 提交于 2019-12-06 00:31:41
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 that's even possible. If you aren't familiar with T4MVC, here's generally what the macro might do to help:

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

孤者浪人 提交于 2019-12-05 22:20:46
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 will work fine, but the target is never picked up. (Valid link, but sent to _self rather than the stated

T4MVC and Resharper Navigation

…衆ロ難τιáo~ 提交于 2019-12-05 17:02:12
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. For example: @Html.Partial("_Continents" ) When I would use ctrl+b on the string "_Continents" , Resharper knew I wanted to go to the partial view named _Continents.cshtml. Since I have started using T4MVC, the same snippet above could be written: @Html.Partial( MVC.CascadingDropDownLists.DropDownAjaxPost

T4MVC alternatives for ASP.NET 5?

主宰稳场 提交于 2019-12-05 12:33:25
T4MVC is not supported yet or ever in ASP.NET 5. Is there any other similar solution ? I need strongly typed views and controllers names. Looks like there is a side project called R4MVC but it hasn't been updated in 5 months. R4MVC is a Roslyn code generator for ASP.NET MVC vnext apps that creates strongly typed helpers that eliminate the use of literal strings in many places As Stafford Williams pointed out, a side project was started a long time ago, but was stalled due to (at the time) breaking changes in the Roslyn compiler. Luckily, the project was revived, and R4MVC has just released it

T4MVC and duplicate controller names in different areas

爱⌒轻易说出口 提交于 2019-12-05 09:03:27
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 the case, register this route by calling an overload of the 'MapRoute' method that takes a 'namespaces'

Make T4MVC work with ASP.NET 5

﹥>﹥吖頭↗ 提交于 2019-12-05 04:55:07
According to the latest comments in this thread, .tt templates will now after all be supported in ASP.NET 5 starting with Visual Studio Update 1. Which IMHO would be great because after using T4MVC for years, I certainly don't wanna go back to using magic strings for route/view names (error prone and not refactoring-friendly). However, I can't quite get it to work with ASP.NET 5 RC and Visual Studio Professional 2015 Update 1. Here's what I've tried: Adding the T4MVC NuGet (3.16.5) to a blank ASP.NET 5 solution: nope, CoreCLR complains and no .tt files are added to project: Error NU1002 The

T4MVC Base controller doesn't have default constructor

╄→尐↘猪︶ㄣ 提交于 2019-12-04 08:53:53
My controller is inherited from anothe controller which doesn't have default constructor. T4MVC generates the following constructor which assumes base controller has default constructor: protected MyControllerController(Dummy d) { } How can I resolve this problem? Interesting enough, according to this page, version 2.4.00 "fixed issue when a base controller doesn't have a default ctor". I also found this SO question, but my base controller is not generic. This should work fine if you make your base controller abstract. I assume that it never needs to be used directly as a controller? If it

Strongly-typed T4MVC Action/ActionLink

纵饮孤独 提交于 2019-12-02 22:45:21
I've been using T4MVC (FYI: v2.6.62) for quite some time, and I've been slowly moving over our code to this way of working (less reliance on magic strings ). But I've had to stop because, for some reason, T4MVC is unable to translate objects into urls, and only seems to be able to work on primitive types (int/string/etc). Here is an example: Route breakdown: /MyController/MyAction/{Number}/{SomeText} Class: namespace MyNamespace { public class MyClass { public int Number { get; set; } public string SomeText { get; set; } } } Controller: public class MyController { public virtual ActionResult

cannot implicitly convert type void to object. .NET MVC PartialViewResult

拜拜、爱过 提交于 2019-12-02 21:32:22
I have the following controller action: [ChildActionOnly] public virtual PartialViewResult ListActions(int id) { var actions = meetingActionRepository.GetAllMeetingActions(id); return PartialView(actions); } And the following action link (using t4MVC and the razor syntax) <p> @Html.RenderAction(MVC.MeetingActions.ListActions(Model.MeetingId)) </p> However this gives me the error: cannot implicitly convert type void to object As far as i can tell the controller action is ok, so what could be giving me this error? Darin Dimitrov Like this: <p> @Html.Action(MVC.MeetingActions.ListActions(Model