Copied to clipboard

Flag this post as spam?

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


  • Liam 22 posts 158 karma points
    Dec 03, 2013 @ 11:15
    Liam
    0

    Querying custom database table data

    Umbraco v 6.1.6

    I have built a site which has numerous articles which are all rateable. When an Article is rated the NodeID and rating (1 to 5 stars) is stored in a custom database table. I am also going to store how many times the article has been viewed by incrementing an integer count for each visit to the page. The end purpose of this is to have info available to list the "top rated" and "Most viewed" articles (nodes). 

    My question is about the best way to extract this info from the database. I know how to query the database using SQL but dont really want to hit the database every time. Has anyone done this before and if so what is the best way to do this in Umbraco? 

    Cheers.

    Liam

  • Bo Damgaard Mortensen 719 posts 1207 karma points
    Dec 05, 2013 @ 19:46
    Bo Damgaard Mortensen
    100

    Hi Liam,

    In my opinion, the "best" (read: easiest) way of quering data in a custom table is to use the built-in (since v. 6 I believe) PetaPoco mini ORM :-) It's easy to set up and dead simple to use. Read more about PetaPoco here: http://www.toptensoftware.com/petapoco/

    (Damn, that sounded almost like a commercial ;-))

    All the best,

    Bo

  • Liam 22 posts 158 karma points
    Dec 05, 2013 @ 19:54
    Liam
    0

    Thanks Bo, I tried a few things and actually ended up using PetaPoco :) 

    As you say, no fuss and I was up and running in no time. 

    Thanks for your reply.

    Liam

Please Sign in or register to post replies

Write your reply to:

Draft