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?
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/
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
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
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
is working on a reply...