Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Martin 114 posts 313 karma points
    Nov 11, 2014 @ 12:17
    Martin
    0

    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

  • James 251 posts 1169 karma points
    Nov 11, 2014 @ 14:23
    James
    0

    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.

     

  • Martin 114 posts 313 karma points
    Nov 11, 2014 @ 15:43
    Martin
    0

    Thanks James for your advice.

  • Andy Butland 422 posts 2334 karma points MVP 4x hq c-trib
    Nov 11, 2014 @ 21:22
    Andy Butland
    0

    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

Please Sign in or register to post replies

Write your reply to:

Draft