Example #1
0
        //////////////////////////////////////////////////////////////////////
        /// <summary>helper method to create a new, decoupled entry based on a feedEntry</summary>
        /// <param name="entryToImport">the entry from a feed that you want to put somewhere else</param>
        /// <returns> the new entry ready to be inserted</returns>
        //////////////////////////////////////////////////////////////////////
        public static AtomEntry ImportFromFeed(AtomEntry entryToImport)
        {
            Tracing.Assert(entryToImport != null, "entryToImport should not be null");
            if (entryToImport == null)
            {
                throw new ArgumentNullException("entryToImport");
            }
            AtomEntry entry = null;

            entry = (AtomEntry)Activator.CreateInstance(entryToImport.GetType());
            entry.CopyEntry(entryToImport);

            entry.Id = null;

            // if the source is empty, set the source to the old feed

            if (entry.Source == null)
            {
                entry.Source = entryToImport.Feed;
            }
            Tracing.TraceInfo("Imported entry: " + entryToImport.Title.Text + " to: " + entry.Title.Text);
            return(entry);
        }