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

Forums / General Discussions / Data Migration into Sitefinity

Data Migration into Sitefinity

4 posts, 0 answered
  1. Sam
    Sam avatar
    21 posts
    Registered:
    18 Aug 2010
    20 Sep 2010
    Link to this post
    I'm attempting to migrate news like items from a legacy database into the sitefinity database.  I want to do this with a generic windows application as it will be done only once. 

    I keep getting exceptions as if I'm not using the right method to connect.  I've copied the pertinent web.config entries to my app.config, but I'm pretty stuck at this point.  The latest exception is:

    System.TypeInitializationException: The type initializer for 'Telerik.Cms.Web.CmsHttpRequest' threw an exception. ---> System.NullReferenceException: Object reference not set to an instance of an object.
       at Telerik.Cms.Web.CmsHttpRequest..cctor()
       --- End of inner exception stack trace ---
       at Telerik.Cms.Web.CmsHttpRequest..ctor(String rawUrl)
       at Telerik.Cms.Engine.ContentProviderBase.Initialize(String name, NameValueCollection config)
       at Telerik.Cms.Engine.Data.Providers.DefaultProvider.Initialize(String name, NameValueCollection config)
       at Telerik.ManagerBase`1.InstantiateProvider(ProviderSettings providerSettings, Type providerType)
       at Telerik.ManagerBase`1.InstantiateProvider(ProviderSettings providerSettings)
       at Telerik.ManagerBase`1.SetProvider(String providerName)
       at Telerik.ManagerBase`1..ctor(String providerName)
       at Telerik.Cms.Engine.ContentManager..ctor(String providerName)
       at Telerik.Cms.Engine.ContentManager..ctor()
       at Telerik.Cms.Engine.ContentManager.get_Providers()
       at Telerik.Cms.Engine.ContentManager.OnInitialized()
       at Telerik.ManagerBase`1.Initialize()
       at Telerik.ManagerBase`1..ctor(String providerName)
       at Telerik.Cms.Engine.ContentManager..ctor(String providerName)
       at Telerik.News.NewsManager.get_Content()
       at MigrationTools.NewsMigration.importButton_Click(Object sender, EventArgs e)


    Basically, I have something like this:

    var newsManager = new NewsManager("News");
                    IContent content = newsManager.Content.CreateContent("text/html");
     
                    content.Content = release.Copy;
                    content.SetMetaData("Title", release.Title);
                    content.SetMetaData("Summary", release.Summary);
                    content.SetMetaData("Author", release.Authors);
                    content.SetMetaData("Publication_Date", release.PublicationDate);
                    content.SetMetaData("Expiration_Date", release.ExpirationDate.HasValue ? release.ExpirationDate.Value : (DateTime?)null);
     
                    progressText.Text += string.Format("News Item added - {0}{1}", content.GetMetaData("Title").ToString(),
                                                                                         Environment.NewLine);
     
                    newsManager.Content.SaveContent(content, ContentStatus.Published);

    Any help or ideas would be much appreciated!

    Thanks again,

    Sam Ferrise
    sam.ferrise@fireflylogic.com

    EDIT: It looks like the exception is being thrown from the IContent content = newsManager.Content.CreateContent("text/html"); line.
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    20 Sep 2010
    Link to this post
    Hi Sam,

    Also we check for HostingEnvironment and IsHosted property which gets a value indicating whether the current application domain is being hosted by an ApplicationManager object.

    If you use windows application you have to migrate your data through web service that is called from your application whereas the web service should be located in Sitefinity.

    All the best,
    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
  3. Sam
    Sam avatar
    21 posts
    Registered:
    18 Aug 2010
    20 Sep 2010
    Link to this post
    Just so I make sure I understand:

    1.  I have to write a webservice inside the Sitefinity app that does whatever I need it to (in this case add news items).
    2.  Write a Windows app that has a service reference to that webservice, and calls a method on it to insert the data.

    Does that sound right?

    Thanks!
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    20 Sep 2010
    Link to this post
    Hello Sam,

    Yes this is what you have to do. Here is a similar scenario that calls a web service from console application to trigger our index. Basically you have to do the same.

    Greetings,
    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
4 posts, 0 answered