Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to best integrate existing database data in a content type

I have an existing database (SQL) with relational data (for example with various 1-n and m-n relationships) that I would like to integrate into a Orchard CMS based website. That database has a ASP.NET Dynamic Data as the backend data maintenance application.

What I would like to do is integrate this information into Orchard, i.e. use Orchard CMS to surface the information to the users. Furthermore, I would like to take advantage of Orchard's concept to extend a content type with further functionality (example tagging, comments).

But: I struggle with finding the best way to integrate that data without creating a complicated maintenance process (creating a content part where one would have to specify the Id of the item in my existing database).

Unfortunately, I did not find any sample for what I would like to achieve... Any suggestions?

like image 506
Marcel Niederhauser Avatar asked Mar 22 '11 13:03

Marcel Niederhauser


1 Answers

If you have an existing, complex database, moving it to Orchard storage system completely would be a very painful process...

The best option would be to keep the existing data in the current database, the Orchard content in second one and wire them together (feed the content part with appropriate data from your primary db) on a content part handler level.

I wrote a short walkthrough about how to achieve that in an answer for other, very similar SO question - here.

After all, if you want to store everything in one place, you can always write your own IRepository<> implementation to store content parts, but it's a lot of work, and I'd advise you to avoid that unless you really have to.

HTH

like image 97
Piotr Szmyd Avatar answered Oct 12 '22 07:10

Piotr Szmyd