Bringing Data !?

Topics: Administration, Writing modules
Sep 11, 2011 at 10:24 PM

I have a database filled with 1000s of Articles I want to save that data to the Orchard Db , I'm planning to create the a content types to match that data to Orchard mechanism , now what makes sense is that data for sure structured in a totally different way rather than orchard's db , so I will have to track where content types created in Orchard are saved then follow the same way to save my data , but that will be a very hard and long task I guess , if any one have any ideas I will be thankful ...

Coordinator
Sep 11, 2011 at 10:27 PM

Well, remember that parts don't necessarily need records, or to be stored in the Orchard DB. So you should be able to surface your data as Orchard content without it being necessarily stored as regular content records in the Orchard DB.

Sep 13, 2011 at 7:45 AM
bertrandleroy wrote:

Well, remember that parts don't necessarily need records, or to be stored in the Orchard DB. So you should be able to surface your data as Orchard content without it being necessarily stored as regular content records in the Orchard DB.

you mean that I can use the data already stored at my data base without any migration! , how exactly? I have no idea about how to do that , I'm extremely new to Orchard and many techniques it uses

Coordinator
Sep 13, 2011 at 7:50 AM

Orchard content parts can act as façades to legacy data like you have here. All you have to do is use your old data from the driver instead of letting Orchard repositories do the work.

Sep 14, 2011 at 2:30 PM

Another option, if you do want to import the articles into the Orchard database, is to use the import functionality from the ImportExport module. This will require a one-time transformation step though. You'll have to write some code to transform your old data into the XML format used by Orchard's ImportExport mechanism. What you can do is setup an Orchard site and define the content type the way you want it and enter an example or two. Then Export the data for that content type in order to see the format. If you can then transform your old data into that format, you'll be able to import it into Orchard and then they'll all be proper content items in Orchard.

Developer
Sep 16, 2011 at 11:11 PM
Edited Sep 16, 2011 at 11:12 PM

If I were you, I'd take Kevin's approach.

The other one, which I was using lately is to create a simple WCF service, that would serve your existing data, and fetch those from the driver/handler (using ChannelFactory or via Service Reference added to your module). It's similar approach to Bertrand's although it doesn't use and additional database connection (I guess that's what Bertrand had in mind:). I had some issues with NHibernate transactions when tried to do some operations on a second database (don't know why though - didn't have time to investigate - I just simply took the WCF way).

- Piotr

Sep 24, 2011 at 12:17 PM

Thanks a lot everyone special thanks for bertrandleroy and pszmyd always helpful and sorry for my delayed reply I was tired , about the Migration me and the team decided to create the content that matchs the content types we have on our site then make normal migration tools so we will track where Orchard will save the data then migrate all the content ,Another idea was to insert data from the content manager so we will inject the data to the content manager mechanism and it will handle the saving of the data into the proper tables at the Orchard DB ,

I guess both works right what do you think ?

Coordinator
Sep 24, 2011 at 8:53 PM

Both options sound fine from what I can understand.

Nov 5, 2011 at 11:07 AM

OrchB, I was wondering how you got on with this migration? I'm facing the same task. 

Nov 5, 2011 at 7:46 PM

Create the content types u want to migrate the data into ( via dashboard or ContentDefinitionManager ) then create ur own module for the Migration , follow the mechanism in which every content type will be save , and do the same , it would take u much trials to achieve it , but it's the best way , rather than trying to follow the sql tables and try manually

Orchard ContentDefinitionManager's publish and create methods are great to handle all the details u need and sure some other helpers , that's it , now my data is already migrated