I know that I can create my own T4 tempates for creating pages for Edit, Detials, Edit, etc. but I would like to download some new ones that have already been created. Are there any out there available for (preferably free) download?
Have you tried MVCScaffolding? You can get it via Nuget.
blog about MVCScaffolding
Related
I was developing with cakephp for a few years and now want to try out asp.net mvc.
In cakephp there is a bake plugin, that allows to create standard functionalities based on customizable templates. E.g. changing these templates according to my needs
1) for controller
https://github.com/cakephp/bake/blob/master/src/Template/Bake/Controller/controller.ctp
https://github.com/cakephp/bake/blob/master/src/Template/Bake/Element/Controller/index.ctp
https://github.com/cakephp/bake/blob/master/src/Template/Bake/Element/Controller/add.ctp
2) for model file
https://github.com/cakephp/bake/blob/master/src/Template/Bake/Model/table.ctp
3) for view files
https://github.com/cakephp/bake/blob/master/src/Template/Bake/Template/index.ctp
https://github.com/cakephp/bake/blob/master/src/Template/Bake/Element/form.ctp
I could run a command from CLI and get full functional validation, controller files with actions and view files - based on the existing tables' structures and relations between them. The plugin will create actual php files in corresponding directories with content according to template files. Having pre-customized bake templates allows to generate the CRUD or any other custom functionality in a few minutes.
Is there a similar functionality in asp.net mvc (v5 or above)? The desired features are to be able to fully customize the templates, which will be used to create controllers, cshtml files and model files - assuming that we already have the tables with foreign key associations in the database. (Preferably free, but not necessarily)
Thanks
I think this link might help you with templates in visual studio. If you want to use command line, maybe yeoman can help you. See this link to see if it'll work for you.
I'm new to Umbraco. Currently is using v7.1.4.
I know that MVC partial views can be created under Settings > Partial Views.
If I have switch the rendering engine from MVC to webforms, where should I create .Net user control?
Just to add to CMayers answer, i generally prefer to create a separate project called usercontrols (just for the sake of knowing what it is) and then using xcopy in the build event copy the dll to the bin folder of the umbraco installation. Likewise the ascx pages are copied into the UserControls folder of the umbraco installation.
Then from the umbraco backend in the developer section, you can create the macro and associate the relevant ascx page to it.
All your .NET Usercontrols should be created in the 'UserControls' folder that comes with the default Umbraco installation.
If you don't copy them to here, then you wont be able to access your user controls from the Macro section of the CMS "Choose a file to render".
I am trying to recreate the ASP.NET Single Page application as demonstrated by Steven Sanderson
Single Page Applications - for desktop, mobile, tablet with ASP.NET MVC4
I have downloaded and installed the Build Preview - http://www.asp.net/vnext
I have using NuGet, tried to update my SPA Scaffolding to ASP.NET SPA MVC 4 (Beta)
I am running Visual Studio 2012
When i create a new MVC4 application, there are some distinctive differences between what i have and the demo's i see.
Primarily, after create a new project, if you view what you have the sites look completely difference
What Steve Sanderson Gets
What I Get
Then continuing to follow his example, he created a controller and has an option of
Single Page Application with read/write actions and views, using Entity Framework
This is not avaiable in my Create Controller Dialog
What Steve Sanderson Gets
What I Get
Why are my options differen't?
What have I not installed?
Thanks for any help
The new SPA template is a completely different template, as you have discovered. Short story ... the new template is revised to be a starting place, the old template was deemed too prescriptive.
The new template is a preview and will have more changes by the time it is released. The idea is you can use it as a starting point for a SPA and then add features and other libraries as needed.
UPDATE: If you want more info on what's in the latest template you can read my post here: http://www.johnpapa.net/insidespatemplate
I'm developing a plugin based application using MEF and Asp.NET MVC 3 and I want to create a custom project template to give third party developers when creating new plugins for application.
I can easily export it as a project template but since the host is developed in ASP.NET MVC 3, It seems more logical to be inside new Asp.Net MVC 3 project dialog.
Any ideas?
After some digging and 'reflecting', I got a template to successfully show up in the dialog. Most of the credit goes to this post: Add custom viewengine to New project dialog?
The key to getting it working on my machine (64bit) was the registry path mentioned in the answer in that post. I also found via Reflector there is a SupportsHTML5 key too, if you need that.
Here is a screen shot of my template:
and here are the registry keys (there is also a title and description at the MyOwnTemplate node)
If you look up your template directory for Visual Studio, and check out the template:
MvcWebApplicationProjectTemplatev3.0.cs.zip
(VS Install dir)\Common7\IDE\ProjectTemplates\CSharp\Web\1033
The thing to look at here is this line:
<WizardExtension>
<Assembly>Microsoft.VisualStudio.Web.Mvc.3.0, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35</Assembly>
<FullClassName>Microsoft.VisualStudio.Web.Mvc.UserInterface.MvcTemplateWizard</FullClassName>
</WizardExtension>
So they have got a custom Wizard working here.
these questions look to be similar:
Blank Asp.net MVC template
How to write an MVC3 Project Template that will offer option Razor or .aspx views
Basically, they say the wizard isn't open source but you could potentially write your own custom wizard.
EDIT:
here are a couple of page that tell you how to create your own wizard:
http://msdn.microsoft.com/en-us/library/ms185301.aspx
http://www.codeproject.com/KB/system/create_VS_wizard.aspx
I just wrote a blog post that covers how to do this and provides a zip file and a batch file with an example.
http://haacked.com/archive/2011/06/06/creating-a-custom-asp-net-mvc-project-template.aspx
When I'm adding a new strongly-typed view to an ASP.NET MVC project, I can select between different view content templates (Create Details, Edit, List). I have read these are templates based on the Visual Studio T4 code generation engine.
How can I author and configure my own templates and let them appear in the available templates when adding a new view?
ASP.Net MVC - T4 Fun
T4 Templates: A Quick-Start Guide for ASP.NET MVC Developers
Create following folder structure:
{YourMVCProject}\CodeTemplates\AddView
Put your custom T4 templates (*.tt) in this folder. You will see the magic!
You might want to take a look at David Hayden's site: http://www.pnpguidance.net/Tag/T4.aspx -- He offers several screencasts on T4 and MVC that got me started. Also take a look at the T4 toolbox: (www.codeplex.com/t4toolbox). This provides additonal helpers for T4 templates.
You can add a package to your project using NuGet that will add the existing code templates to your project. From that point you could edit them or just create new ones in the same location and you should see them in the tooling.
http://nuget.org/List/Packages/Mvc3CodeTemplatesCSharp