What is best practice for connecting to and publish from database using Razor?
Hi,
What would be best practice is you want to connect to and publish data from a database using Razor syntax? I am running Umbraco using MVC but I don't have Visual Studio. I know that you could make a "shortcut" and put everything in a view ( i.e. connection string, fetch, and layout etc.) but if you what to do it in a more correct MVC mannor, how is it done? Would Visual studio be required in order to create/compile necessary Controllers and Models?
Or is there perhaps any good package that would handle connection and querying in a more structured way using e.g. GUI?
You can put code that needs compilation - i.e. .cs files like controllers and models - in the App_Code folder. That way you can go someway to separate this kind of thing from your views. But really Visual Studio is probably a good investment if you are doing much of this type of thing, as it'll give you compile time checking and Intellisense which makes working this way much easier. As James says, there is a free version that would suffice.
What is best practice for connecting to and publish from database using Razor?
Hi,
What would be best practice is you want to connect to and publish data from a database using Razor syntax? I am running Umbraco using MVC but I don't have Visual Studio. I know that you could make a "shortcut" and put everything in a view ( i.e. connection string, fetch, and layout etc.) but if you what to do it in a more correct MVC mannor, how is it done? Would Visual studio be required in order to create/compile necessary Controllers and Models?
Or is there perhaps any good package that would handle connection and querying in a more structured way using e.g. GUI?
Any hints/comments are highly appreciated,
Martin
Hello there,
I dont know if this helps but I will give you some relevant resources.
When learning about the fundamentals of MVC i used:
http://pluralsight.com/training/Player?author=scott-allen&name=mvc4-building-m6-ajax&mode=live&clip=0&course=mvc4-building
Great walk through and easy to understand. This may be a good starting point for learning about connecting to databases using MVC.
Lastly, do you know there is a free version of VS? Visual Studio Express for Web.
http://www.microsoft.com/en-gb/download/details.aspx?id=43722
You can download it and use it for free. This is a great starting point for basic projects (and advanced ones to be honest).
Hope this may have helped.
Thanks James for your advice.
You can put code that needs compilation - i.e. .cs files like controllers and models - in the App_Code folder. That way you can go someway to separate this kind of thing from your views. But really Visual Studio is probably a good investment if you are doing much of this type of thing, as it'll give you compile time checking and Intellisense which makes working this way much easier. As James says, there is a free version that would suffice.
Andy
is working on a reply...