+1-888-365-2779
Try Now
More in this section

Forums / Deployment / merging!

merging!

8 posts, 0 answered
  1. Nick
    Nick avatar
    91 posts
    Registered:
    04 Aug 2008
    29 May 2009
    Link to this post
    Sorry guys, i did already post this thread (or so i thought, but i cant find it in the forum anymore so i guess something went wrong with it!)

    Anyways, let me start again,

    I've seen this question kind of answered in another thread (coincedentally by someone with the same name as me!), but i don't feel the answer was detailed enough to distill confidence in me.

    Basically we have two versions of the CMS - one for developement and another for production. A lot of work has been done on the developement server, creating a large structure/hierarchy with many many pages. There is also a lot of content currently on the production server that we do not wish to lose, or risk damaging. Thus we could not use the method you outline in your user manual as this would result in the loss of content - we want to merge not migrate..

    So, i have seen in this other thread previously mentioned, that i can copy content over by adding the dev DB as an additional provider to the production CMS. And then by using two instances of the CmsManager class i could pass content between the separate installations.

    Regarding the above method, where should such code be executed? Would i have to write an additional module to plug into the CMS? Or would a standalone executable (i.e. independent of the CMS) do the job? or would i have to write a webservice to do it? I'm trying to ascertain the visibility of content, would an instance of a CmsManager used on the production server, but outside of the CMS have visibility of the content from the providers?

    Secondly, what other potential methods of merging are available? Would i be able to perform a comparison of the two databases and copy over and rows of the database that are on the development CMS, but not on the production installation? If so, is this safe, and guaranteed not to cause problems? It is a paramount concern that we keep our current content on the production CMS from potential corruption.

    Are there any other methods for achieving the same results? Would it be an option to export all content from the CMS using the export tool and then parse the XML and use the CmsManager class to add the pages in?

    Sorry to bombard you with such a long post, demanding so many answers but i would really like to be able to do this as soon as possible, but without causing unecessary risk of corruption of content on the production CMS.

    thanks ever so much,
    Nick
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    29 May 2009
    Link to this post
    Hi Nick,

    Thank you for contacting us.

    There are two options that I could come up right away.
    1. You can use some Database Synchronization and Database replication tools for merging/comparing  the content between your servers.

    2. Create a new provider on your dev or production server. Let say we will get all data firstly to the dev and then we will go live.
    Steps.
    1. Add  new connections string to your dev project.
    2. Create a new provider ProductionNews - Let' say for News.
    3. Set the connectionStringName to your ProductionNews provider to the newly added connection string.
    4. Then create a user control and add logic for copying the content from one provider to another.
    5. You need to choose an identifier that will help you to merge the content if there are the same items - if not it will be easy.

    Here is a pseudo code:

    approach 1:

            //two instaces of ContentManager 
            ContentManager manager1 = new ContentManager("ProductionProvider"); 
            ContentManager manager2 = new ContentManager("DevProvider"); 
            // get the content form ProductionProvider 
            IList listofConentItems1 = manager1.GetContent(); 
            for (int i = 0; i < listofConentItems1.Count; i++) 
            { 
                IContent content = ((IContent)listofConentItems1[i]); 
                // save the content that we have get from the  
                //ProductionProvider to DevProvider 
                manager2.SaveContent(content); 
            } 

    approach2:

           ContentManager manager3 = new ContentManager("ProductionProvider"); 
            ContentManager manager4 = new ContentManager("DevProvider"); 
            IList listOfAllitems1 = manager3.GetContent(); 
            IList listOfAllitems2 = manager4.GetContent(); 
            foreach (IContent c1 in listOfAllitems1) 
            { 
                bool shouldInsert = true
                foreach (IContent c2 in listOfAllitems2) 
                { 
                    // identifier is the title 
                    // you can try choosing an appropriate identifier 
                    if (c1.GetMetaData("Title") == c2.GetMetaData("Title")) 
                    { 
                        shouldInsert = false
                        break
                    } 
                } 
                if (shouldInsert) 
                    manager4.SaveContent(c1); 
            }  

    I hope this will give you some idea about your case.

    Best wishes,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. Nick
    Nick avatar
    91 posts
    Registered:
    04 Aug 2008
    29 May 2009
    Link to this post
    Thanks for your reply ivan! It is very much appreciated that you offer a solution so quickly.

    The database method would obviously be the easier of the two approaches in that i could use an existing tool to do so. However i feel worried that there may be clashes of primary keys or GUIDs when copying records across. Have you any information on whether this approach is 100% safe or whether it carries with it a small risk?

    The second approach seems very simple and this will probably be the version we will go for as it would allow for more stringent criteria on what will be copied. I assume your first version of this approach is blindly copying all the content across, whereas the second version omits content with duplicate titles? would i also be right in assuming that the structure would not be preserved using the code as-is? i guess some extra logic is needed?

    thanks again :-)
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    29 May 2009
    Link to this post
    Hello Nick,

    In both databases - production and dev your content items have different guids, so I do not think there would be a problem with the primary key or a guid.
    As for the other approaches that use Sitefinity API

    1. Approach - gets and copies the content from one provider to another without any comparison.
    2. Approach - it gets and copies( to provider4)  the items by title that does not exist in list one.

    You can modify the code snippet depending on your needs.

    All the best,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  5. Nick
    Nick avatar
    91 posts
    Registered:
    04 Aug 2008
    16 Jun 2009
    Link to this post
    I'm back again, so apologies for digging up an oldish thread, but i have a few more questions.

    We're still looking into the best method by which we can merge and migrate content. I have suggested to our DBAs that using some of the RedGate software might be the best route as it avoids the need to develop a solution ourself.

    The DBAs are a little hesitant to just unleash the redgate comparison functionality on the databases, without some guidance/help/tips.

    Thus, I would like to request some information from anyone (and everyone!) who has experience with this :-) any help would be much appreciated. for example, which tables would need to be copied over (all of them??)? Any other help would be most gratefully appreciated.

    Thanks for your continuing support guys :-)
    Nick
  6. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    16 Jun 2009
    Link to this post
    Hi Nick,

    You should merge all data instead of some tables. The software you are going to use will show you what are the differences and in which tables. There are internal dependencies and when working with queries if you missed something you will face a lot of problems.

    If someone else has been performing merging, please share your approach with us.

    Greetings,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  7. Jason
    Jason avatar
    4 posts
    Registered:
    23 Jul 2010
    30 Aug 2010
    Link to this post
    I have been reading the User Manual and forum posts trying to find a solution. This Approach #2 seems like it might be what we need and I would like more info on how to implement it.

    We have sitefinity on the development server and on the production server. It is already live. People with specific permissions will make content updates directly on production. We need a way to merge our changes from the development server without losing the changes that are in the production server.

    We are thinking of testing what ever process we come up with by merging the production server onto the developement server (we dont care about losing what is currently on development. we need to make sure we already have a way to merge before continuing with changes in development).
  8. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    31 Aug 2010
    Link to this post
    Hello Jason,

    To implement the second option you need to create a custom tool that checks for duplicate entries of IContent items. The main problem here is that the ContentManager allow you to have items with the same title and it would be better if you use the IContent url or UrlWithExtension property to check for identical IContent objects.
     You also have to replicate all related data for a given IContent - metakeys, tags, content etc. You can take a look at


    Best wishes,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Register for webinar
8 posts, 0 answered