Umbraco template not being created from new MVC View in existing application - asp.net-mvc

I have an existing project that is running Umbraco 7.10
Whenever we create a new view, the template is not created in Umbraco (but new Partials are) when we deploy to existing environments
We are not using uSync at present and the umbracoSettings.config template section is set to Mvc rather than WebForms
What is stopping the template being present in Umbraco? is it something I am missing in the cmsTemplate table?
Many thanks

You need to create the template in Umbraco and then manually include in your VS project not the other way around.
There is a db component to a template/view which only gets created if you do things from Umbraco rather than VS. Partials do not have a db component and are simply read from the file system.
uSync would be a good move if you have separate databases for different environments otherwise you will have to add the template to each Umbraco instance.

Related

Angular2 sub directory of umbraco

I have an umbraco application. I want to integrate angular2 sub directory as a part of umbraco application. If some one type UmbracoURL/Inventory, I want to show angular2 Inventory application. Can any one provide me a solution please...?
Is the Angular2 app a single page app? In that case you can integrate it as part of the Umbraco application.
You'll need to create a template in Umbraco with you Angular2 application, perhaps introduce a new documenttype called Inventory? Then create a new node called Inventory at root level in the Content tree, set the template to new Inventory template. And you should be able to access the angular2 app through the /inventory url.
If you want to use the content of a physical directory in Umbraco, you'll probably have to change the Umbraco/MVC routing

Cakephp bake equivalent in asp.net mvc

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.

Umbraco: creating user control

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".

following iterative and agile in asp.net MVC

ok, i know there are a lot of posts online that specify how to do iterations with MVC.
my question is slightly different. when i used to do iterations using WebForms, i was creating one thing only and finishing that one thing till the end which was including the deployment on production.
for example, i was creating a webpage and deploying it, then i create the second page and deploy it. so .dll files were added to my bin folder while the previous dlls remain untouched. at the other hand, when i was making a change latter on, there was this one file that needed to be replaced on production.
now here is the question, how can i acheive the same thing in mvc? beause it just doesn't deploy each page into an individual dll. each time that i add something i have to redeploy the application dll which is not really wise! i played around with deployment options in visual studio but no luck!
There is nothing preventing you from putting controllers and other code in separate assemblies and dropping them in an existing application. Like any ASP.NET based application an MVC application will automatically restart if you add or modify any file in the bin folder or modify web.config.
If you're using Razor you can use RazorGenerator to generate code for your views and compile them into the same assembly.
You may need to write some additional logic though to get routes, model binders etc. wired up correctly.
For a more structures approach to compose the application of separate modules, you may want to look into portable areas. This is an extension to ASP.NET MVC that allows you to package the entire module (including views, css, js etc.) into a single assembly.
First thing, you have to work on the title of the post, it does not match the content of the post.
In asp.net mvc u can choose to deploy only what changed. I.e. If you only changed the .cshtml file, then you can just replace it with the file in production. However if you change any controller class (C#/Vb code), then you will have to upload the web project dll file too so that this new changes are available in the production env

How to seperate MVC project to several smaller MVC projects

I have an MVC 3 app that has some core functionality (most important is autorisation) but mainly serves as a portal to different areas or modules. I want to organize thit to different modules that with minor changes also can be deployed as their own website.
The project consists of a Forum, Blog engine, Messaging between users + 4-5 upcoming modules.
I looked at ScottGu's blog about MVC 2 and found something that seemed perfect:
Depending og what the customer need I want to only give them the exact modules they can use. It is also easier from a maintainence view to be able to work and update referencd assemblies in each project and just do a full update for the customers that have that spesific module on their server.
But in MVC 3 there is no apparent way to use Areas this way, do you know how?
Status
I will try to add MVCContrib Portable areas to my existing solution and convert my areas ower and will post back the results. If it works I will mark it as the accepted solution.
MVCContrib has portable areas.
http://mvccontrib.codeplex.com/wikipage?title=Creating%20a%20Portable%20Area&referringTitle=Documentation
This is possible in MVC3:
From:
http://bob.archer.net/content/aspnet-mvc3-areas-separate-projects
Right click on the shell project and "Add Area...". Type in the area name. This will create an Areas folder with your area in it. (This is not 100% needed but you do need the "Areas" folder and you can steal the XXXXAreaRegistration class for your application.)
Create a new MVC3 empty project in your solution to match your area. Move the XXXXAreaRegistration.cs file from the shell mvc project to the new project and adjust the namespace as applicable. (Or you can manually create an area registration class, it's a pretty simple class. Just use the Add area template generated one as an example.)
Edit the routes in the AreaRegistration folder as needed.
Delete the folder under the areas folder that the template wizard added.
Modify the web.config of the new project and take out the connection strings and the authentication, membership, profile, rolemanger sections. You will not need to deploy this web.config but the razor intellisense doesn't work without it during dev time.
Delete the global.asax file from the area's project or you will get extra default routes.
Create a virtual directory in the "Areas" folder of the shell project with the name of your area as the alias and point it to your "area" project. You will need to use IIS or IIS Express for this. I use IIS. For IIS Express you can use the appcmd.exe in the IIS Express folder or you can edit the applciationhost.config file.

Resources