Copied to clipboard

Flag this post as spam?

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


  • Graeme W 113 posts 289 karma points
    Jan 15, 2014 @ 23:20
    Graeme W
    0

    Querying database tables directly

    I've got a couple of requirements to display (read-only) "non umbraco" data in my Umbraco site. One is from a table in the Umbraco database populated by a package, another is in a completely different SQL database.

    I'm using v 6.16 Mvc. Am I right in thinking that using a surface controller with a partial view would be the best way of doing this?

  • Andy Butland 422 posts 2334 karma points MVP 4x hq c-trib
    Jan 16, 2014 @ 21:54
    Andy Butland
    100

    Makes sense to me.  From your controller you can call out to other classes as necessary to pull in your data from the database, and you can populate a custom view model to pass you your partial view for display.

    Andy

  • Graeme W 113 posts 289 karma points
    Jan 17, 2014 @ 15:09
    Graeme W
    0

    Hi Andy. Thanks for your reply.

    Yes I can confirm this approach has worked.

    Umbraco's implementation of PetaPoco actually makes it quite easy - just include a reference to Umbraco.Core.Persistence and you can query your database as described here http://www.toptensoftware.com/petapoco/

Please Sign in or register to post replies

Write your reply to:

Draft