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