Exemple #1
0
        internal void Version080302()
        {
            logger.LogStep("08.03.02", "Start", false);

            var userName = "******";

            // Add new content types and entities
            var xmlToImport =
                File.ReadAllText(HttpContext.Current.Server.MapPath("~/DesktopModules/ToSIC_SexyContent/Upgrade/08.03.02.xml"));
            var xmlImport = new XmlImport("en-US", userName, true);
            var success   = xmlImport.ImportXml(Constants.DefaultZoneId, Constants.MetaDataAppId, XDocument.Parse(xmlToImport), true);

            if (!success)
            {
                var messages = String.Join("\r\n- ", xmlImport.ImportLog.Select(p => p.Message).ToArray());
                throw new Exception("The 2sxc module upgrade to 08.03.02 failed: " + messages);
            }

            // 2016-03-13 2dm: disabled this rename again, because I tested it without and it seems the manifest works, so this could only lead to trouble one day
            //var desktopModuleNames = new[] { "2sxc", "2sxc-app" };
            //// Update BusinessController class name in desktop module info
            //foreach (var d in desktopModuleNames)
            //{
            //    var dmi = DesktopModuleController.GetDesktopModuleByModuleName(d, -1);
            //    dmi.BusinessControllerClass = "ToSic.SexyContent.Environment.Dnn7.DnnBusinessController";
            //    DesktopModuleController.SaveDesktopModule(dmi, false, true);
            //}
        }
        public ImportResult ImportContent()
        {
            var result = new ImportResult();

            var request = HttpContext.Current.Request;

            var allowSystemChanges = UserInfo.IsSuperUser;

            var appId  = int.Parse(request["AppId"]);
            var zoneId = int.Parse(request["ZoneId"]);

            if (request.Files.Count > 0)
            {
                var file = request.Files[0];
                if (file.FileName.EndsWith(".zip"))
                {   // ZIP
                    var zipImport = new ZipImport(zoneId, appId, PortalSettings.UserInfo.IsSuperUser);
                    result.Succeeded = zipImport.ImportZip(file.InputStream, HttpContext.Current.Server, PortalSettings, result.Messages);
                }
                else
                {   // XML
                    using (var fileStreamReader = new StreamReader(file.InputStream))
                    {
                        var xmlImport   = new XmlImport(PortalSettings.DefaultLanguage, UserIdentity.CurrentUserIdentityToken, allowSystemChanges);
                        var xmlDocument = XDocument.Parse(fileStreamReader.ReadToEnd());
                        result.Succeeded = xmlImport.ImportXml(zoneId, appId, xmlDocument);
                        result.Messages  = xmlImport.ImportLog;
                    }
                }
            }
            return(result);
        }
Exemple #3
0
        internal static void ImportXmlSchemaOfVersion(string version, bool leaveOriginalsUntouched)
        {
            var userName    = "******" + version;
            var xmlToImport =
                File.ReadAllText(
                    HttpContext.Current.Server.MapPath("~/DesktopModules/ToSIC_SexyContent/Upgrade/" + version + ".xml"));
            var xmlImport = new XmlImport("en-US", userName, true);
            var success   = xmlImport.ImportXml(Constants.DefaultZoneId, Constants.MetaDataAppId, XDocument.Parse(xmlToImport),
                                                leaveOriginalsUntouched);

            if (!success)
            {
                var messages = String.Join("\r\n- ", xmlImport.ImportLog.Select(p => p.Message).ToArray());
                throw new Exception("The 2sxc module upgrade to " + version + " failed: " + messages);
            }
        }
Exemple #4
0
        internal void Version080303()
        {
            logger.LogStep("08.03.03", "Start", false);

            var userName = "******";

            // Change "Author" to "Owner" (permissions content type)
            var xmlToImport =
                File.ReadAllText(HttpContext.Current.Server.MapPath("~/DesktopModules/ToSIC_SexyContent/Upgrade/08.03.03.xml"));
            var xmlImport = new XmlImport("en-US", userName, true);
            var success   = xmlImport.ImportXml(Constants.DefaultZoneId, Constants.MetaDataAppId, XDocument.Parse(xmlToImport), false); // Overwrite existing values

            if (!success)
            {
                var messages = String.Join("\r\n- ", xmlImport.ImportLog.Select(p => p.Message).ToArray());
                throw new Exception("The 2sxc module upgrade to 08.03.03 failed: " + messages);
            }
        }
Exemple #5
0
        internal void Version070303()
        {
            logger.LogStep("07.03.03", "Start", false);

            var userName = "******";

            // 1. Import new Attributes for @All content type
            var xmlToImport =
                File.ReadAllText(HttpContext.Current.Server.MapPath("~/DesktopModules/ToSIC_SexyContent/Upgrade/07.03.03-01.xml"));
            var xmlImport = new XmlImport("en-US", userName, true);
            var success   = xmlImport.ImportXml(Constants.DefaultZoneId, Constants.MetaDataAppId, XDocument.Parse(xmlToImport));

            if (!success)
            {
                var messages = String.Join("\r\n- ", xmlImport.ImportLog.Select(p => p.Message).ToArray());
                throw new Exception("The 2sxc module upgrade to 07.03.03-01 failed: " + messages);
            }

            // 2. Import ContentType-InputType and entities for it
            xmlToImport =
                File.ReadAllText(HttpContext.Current.Server.MapPath("~/DesktopModules/ToSIC_SexyContent/Upgrade/07.03.03-02.xml"));
            xmlImport = new XmlImport("en-US", userName, true);
            success   = xmlImport.ImportXml(Constants.DefaultZoneId, Constants.MetaDataAppId, XDocument.Parse(xmlToImport));

            if (!success)
            {
                var messages = String.Join("\r\n- ", xmlImport.ImportLog.Select(p => p.Message).ToArray());
                throw new Exception("The 2sxc module upgrade to 07.03.03-02 failed: " + messages);
            }

            // 3. Hide all unneeded fields - all fields for string, number: all but "Number of Decimals", Minimum and Maximum
            xmlToImport =
                File.ReadAllText(HttpContext.Current.Server.MapPath("~/DesktopModules/ToSIC_SexyContent/Upgrade/07.03.03-03.xml"));
            xmlImport = new XmlImport("en-US", userName, true);
            success   = xmlImport.ImportXml(Constants.DefaultZoneId, Constants.MetaDataAppId, XDocument.Parse(xmlToImport), false); // special note - change existing values

            if (!success)
            {
                var messages = String.Join("\r\n- ", xmlImport.ImportLog.Select(p => p.Message).ToArray());
                throw new Exception("The 2sxc module upgrade to 07.03.03-03 failed: " + messages);
            }

            logger.LogStep("07.03.03", "Done", false);
        }
Exemple #6
0
        internal void Version080004()
        {
            logger.LogStep("08.00.04", "Start", false);

            var userName = "******";

            // Fix AddressMask field in GPS settings content type
            var xmlToImport =
                File.ReadAllText(HttpContext.Current.Server.MapPath("~/DesktopModules/ToSIC_SexyContent/Upgrade/08.00.04.xml"));
            var xmlImport = new XmlImport("en-US", userName, true);
            var success   = xmlImport.ImportXml(Constants.DefaultZoneId, Constants.MetaDataAppId, XDocument.Parse(xmlToImport), false); // special note - change existing values

            if (!success)
            {
                var messages = String.Join("\r\n- ", xmlImport.ImportLog.Select(p => p.Message).ToArray());
                throw new Exception("The 2sxc module upgrade to 08.00.04 failed: " + messages);
            }

            logger.LogStep("08.00.02", "Done", false);
        }
Exemple #7
0
        internal void Version080100()
        {
            logger.LogStep("08.01.00", "Start", false);

            var userName = "******";

            // Add new content types and entities
            var xmlToImport =
                File.ReadAllText(HttpContext.Current.Server.MapPath("~/DesktopModules/ToSIC_SexyContent/Upgrade/08.01.00.xml"));
            var xmlImport = new XmlImport("en-US", userName, true);
            var success   = xmlImport.ImportXml(Constants.DefaultZoneId, Constants.MetaDataAppId, XDocument.Parse(xmlToImport), false); // special note - change existing values

            if (!success)
            {
                var messages = String.Join("\r\n- ", xmlImport.ImportLog.Select(p => p.Message).ToArray());
                throw new Exception("The 2sxc module upgrade to 08.01.00 failed: " + messages);
            }

            // Remove unneeded control key for template file editing
            RemoveModuleControls(new[] { "edittemplatefile" });
        }
Exemple #8
0
        protected void ImportFromStream(Stream importStream, bool isZip)
        {
            var messages = new List <ExportImportMessage>();
            var success  = false;

            if (isZip)
            {
                success = new ZipImport(ZoneId.Value, AppId.Value, UserInfo.IsSuperUser).ImportZip(importStream, Server, PortalSettings, messages, false);
            }
            else
            {
                string Xml    = new StreamReader(importStream).ReadToEnd();
                var    import = new XmlImport();
                success  = import.ImportXml(ZoneId.Value, AppId.Value, Xml);
                messages = import.ImportLog;
            }

            lstvSummary.DataSource = messages;
            lstvSummary.DataBind();
            pnlSummary.Visible = true;
            pnlUpload.Visible  = false;
        }
Exemple #9
0
        internal void Version070200()
        {
            logger.LogStep("07.02.00", "Start", false);

            var userName = "******";

            // Import new ContentType for permissions
            if (DataSource.GetCache(Constants.DefaultZoneId, Constants.MetaDataAppId).GetContentType("|Config ToSic.Eav.DataSources.Paging") == null)
            {
                var xmlToImport =
                    File.ReadAllText(HttpContext.Current.Server.MapPath("~/DesktopModules/ToSIC_SexyContent/Upgrade/07.02.00.xml"));
                //var xmlToImport = File.ReadAllText("../../../../Upgrade/07.00.00.xml");
                var xmlImport = new XmlImport("en-US", userName, true);
                var success   = xmlImport.ImportXml(Constants.DefaultZoneId, Constants.MetaDataAppId, XDocument.Parse(xmlToImport));

                if (!success)
                {
                    var messages = String.Join("\r\n- ", xmlImport.ImportLog.Select(p => p.Message).ToArray());
                    throw new Exception("The 2sxc module upgrade to 07.02.00 failed: " + messages);
                }
            }
            logger.LogStep("07.02.00", "Done", false);
        }
Exemple #10
0
        /// <summary>
        /// Add ContentTypes for ContentGroup and move all 2sxc data to EAV
        /// </summary>
        internal void Version070000()
        {
            logger.LogStep("07.00.00", "Start", false);

            var userName = "******";

            #region 1. Import new ContentTypes for ContentGroups and Templates

            logger.LogStep("07.00.00", "1. Import new ContentTypes for ContentGroups and Templates", false);
            if (DataSource.GetCache(Constants.DefaultZoneId, Constants.MetaDataAppId).GetContentType("2SexyContent-Template") == null)
            {
                var xmlToImport =
                    File.ReadAllText(HttpContext.Current.Server.MapPath("~/DesktopModules/ToSIC_SexyContent/Upgrade/07.00.00.xml"));
                //var xmlToImport = File.ReadAllText("../../../../Upgrade/07.00.00.xml");
                var xmlImport = new XmlImport("en-US", userName, true);
                var success   = xmlImport.ImportXml(Constants.DefaultZoneId, Constants.MetaDataAppId, XDocument.Parse(xmlToImport));

                if (!success)
                {
                    var messages = String.Join("\r\n- ", xmlImport.ImportLog.Select(p => p.Message).ToArray());
                    throw new Exception("The 2sxc module upgrade to 07.00.00 failed: " + messages);
                }
            }

            #endregion



            // 2. Move all existing data to the new ContentTypes - Append new IDs to old data (ensures that we can fix things that went wrong after upgrading the module)

            #region Prepare Templates
            logger.LogStep("07.00.00", "2. Move all existing data to the new ContentTypes - Append new IDs to old data (ensures that we can fix things that went wrong after upgrading the module)", false);

            var          sqlConnection = new SqlConnection(ConfigurationManager.ConnectionStrings["SiteSqlServer"].ConnectionString);
            var          templates     = new DataTable();
            const string sqlCommand    = @"SELECT        ToSIC_SexyContent_Templates.TemplateID, ToSIC_SexyContent_Templates.PortalID, ToSIC_SexyContent_Templates.Name, ToSIC_SexyContent_Templates.Path, 
                         ToSIC_SexyContent_Templates.AttributeSetID, ToSIC_SexyContent_Templates.DemoEntityID, ToSIC_SexyContent_Templates.Script, 
                         ToSIC_SexyContent_Templates.IsFile, ToSIC_SexyContent_Templates.Type, ToSIC_SexyContent_Templates.IsHidden, ToSIC_SexyContent_Templates.Location, 
                         ToSIC_SexyContent_Templates.UseForList, ToSIC_SexyContent_Templates.UseForItem, ToSIC_SexyContent_Templates.SysCreated, 
                         ToSIC_SexyContent_Templates.SysCreatedBy, ToSIC_SexyContent_Templates.SysModified, ToSIC_SexyContent_Templates.SysModifiedBy, 
                         ToSIC_SexyContent_Templates.SysDeleted, ToSIC_SexyContent_Templates.SysDeletedBy, ToSIC_SexyContent_Templates.AppID, 
                         ToSIC_SexyContent_Templates.PublishData, ToSIC_SexyContent_Templates.StreamsToPublish, ToSIC_SexyContent_Templates.PipelineEntityID, 
                         ToSIC_SexyContent_Templates.ViewNameInUrl, ToSIC_SexyContent_Templates.Temp_PresentationTypeID, 
                         ToSIC_SexyContent_Templates.Temp_PresentationDemoEntityID, ToSIC_SexyContent_Templates.Temp_ListContentTypeID, 
                         ToSIC_SexyContent_Templates.Temp_ListContentDemoEntityID, ToSIC_SexyContent_Templates.Temp_ListPresentationTypeID, 
                         ToSIC_SexyContent_Templates.Temp_ListPresentationDemoEntityID, ToSIC_SexyContent_Templates.Temp_NewTemplateGuid, ToSIC_EAV_Apps.ZoneID, 
                         ToSIC_EAV_Entities_1.EntityGUID AS ContentDemoEntityGuid, ToSIC_EAV_Entities_2.EntityGUID AS PresentationDemoEntityGuid, 
                         ToSIC_EAV_Entities_3.EntityGUID AS ListContentDemoEntityGuid, ToSIC_EAV_Entities_4.EntityGUID AS ListPresentationDemoEntityGuid, 
                         ToSIC_EAV_Entities.EntityGUID AS PipelineEntityGuid
FROM            ToSIC_SexyContent_Templates INNER JOIN
                         ToSIC_EAV_Apps ON ToSIC_SexyContent_Templates.AppID = ToSIC_EAV_Apps.AppID LEFT OUTER JOIN
                         ToSIC_EAV_Entities ON ToSIC_SexyContent_Templates.PipelineEntityID = ToSIC_EAV_Entities.EntityID LEFT OUTER JOIN
                         ToSIC_EAV_Entities AS ToSIC_EAV_Entities_3 ON ToSIC_SexyContent_Templates.Temp_ListContentDemoEntityID = ToSIC_EAV_Entities_3.EntityID LEFT OUTER JOIN
                         ToSIC_EAV_Entities AS ToSIC_EAV_Entities_1 ON ToSIC_SexyContent_Templates.DemoEntityID = ToSIC_EAV_Entities_1.EntityID LEFT OUTER JOIN
                         ToSIC_EAV_Entities AS ToSIC_EAV_Entities_2 ON 
                         ToSIC_SexyContent_Templates.Temp_PresentationDemoEntityID = ToSIC_EAV_Entities_2.EntityID LEFT OUTER JOIN
                         ToSIC_EAV_Entities AS ToSIC_EAV_Entities_4 ON ToSIC_SexyContent_Templates.Temp_ListPresentationDemoEntityID = ToSIC_EAV_Entities_4.EntityID
WHERE        (ToSIC_SexyContent_Templates.SysDeleted IS NULL) AND ((SELECT COUNT(*) FROM ToSIC_EAV_Entities WHERE EntityGUID = ToSIC_SexyContent_Templates.Temp_NewTemplateGuid) = 0)";

            var adapter = new SqlDataAdapter(sqlCommand, sqlConnection);
            adapter.SelectCommand.CommandTimeout = 3600;
            adapter.Fill(templates);

            var existingTemplates = templates.AsEnumerable().Select(t =>
            {
                var templateId = (int)t["TemplateID"];
                var zoneId     = (int)t["ZoneID"];
                var appId      = (int)t["AppID"];
                var cache      = ((BaseCache)DataSource.GetCache(zoneId, appId)).GetContentTypes();

                #region Helper Functions
                Func <int?, string> getContentTypeStaticName = contentTypeId =>
                {
                    if (!contentTypeId.HasValue || contentTypeId == 0)
                    {
                        return("");
                    }
                    if (cache.Any(c => c.Value.AttributeSetId == contentTypeId))
                    {
                        return(cache[contentTypeId.Value].StaticName);
                    }
                    return("");
                };

                #endregion

                // Create anonymous object to validate the types
                var tempTemplate = new
                {
                    TemplateID    = templateId,
                    Name          = (string)t["Name"],
                    Path          = (string)t["Path"],
                    NewEntityGuid = Guid.Parse((string)t["Temp_NewTemplateGuid"]),
                    //AlreadyImported = t["Temp_NewTemplateGuid"] != DBNull.Value,

                    ContentTypeId          = getContentTypeStaticName(t["AttributeSetID"] == DBNull.Value ? new int?() : (int)t["AttributeSetID"]),
                    ContentDemoEntityGuids = t["ContentDemoEntityGuid"] == DBNull.Value ? new List <Guid>() : new List <Guid> {
                        (Guid)t["ContentDemoEntityGuid"]
                    },
                    PresentationTypeId          = getContentTypeStaticName((int)t["Temp_PresentationTypeID"]),
                    PresentationDemoEntityGuids = t["PresentationDemoEntityGuid"] == DBNull.Value ? new List <Guid>() : new List <Guid> {
                        (Guid)t["PresentationDemoEntityGuid"]
                    },
                    ListContentTypeId          = getContentTypeStaticName((int)t["Temp_ListContentTypeID"]),
                    ListContentDemoEntityGuids = t["ListContentDemoEntityGuid"] == DBNull.Value ? new List <Guid>() : new List <Guid> {
                        (Guid)t["ListContentDemoEntityGuid"]
                    },
                    ListPresentationTypeId          = getContentTypeStaticName((int)t["Temp_ListPresentationTypeID"]),
                    ListPresentationDemoEntityGuids = t["ListPresentationDemoEntityGuid"] == DBNull.Value ? new List <Guid>() : new List <Guid> {
                        (Guid)t["ListPresentationDemoEntityGuid"]
                    },

                    Type                = (string)t["Type"],
                    IsHidden            = (bool)t["IsHidden"],
                    Location            = (string)t["Location"],
                    UseForList          = (bool)t["UseForList"],
                    AppId               = appId,
                    PublishData         = (bool)t["PublishData"],
                    StreamsToPublish    = (string)t["StreamsToPublish"],
                    PipelineEntityGuids = t["PipelineEntityGuid"] == DBNull.Value ? new List <Guid>() : new List <Guid> {
                        (Guid)t["PipelineEntityGuid"]
                    },
                    ViewNameInUrl = t["ViewNameInUrl"].ToString(),
                    ZoneId        = zoneId
                };

                return(tempTemplate);
            }).ToList();

            #endregion


            #region Prepare ContentGroups
            logger.LogStep("07.00.00", "2. Prepare Content Groups", false);

            var          contentGroupItemsTable  = new DataTable();
            const string sqlCommandContentGroups = @"SELECT DISTINCT        ToSIC_SexyContent_ContentGroupItems.ContentGroupItemID, ToSIC_SexyContent_ContentGroupItems.ContentGroupID, 
                         ToSIC_SexyContent_ContentGroupItems.TemplateID, ToSIC_SexyContent_ContentGroupItems.SortOrder, ToSIC_SexyContent_ContentGroupItems.Type, 
                         ToSIC_SexyContent_ContentGroupItems.SysCreated, ToSIC_SexyContent_ContentGroupItems.SysCreatedBy, ToSIC_SexyContent_ContentGroupItems.SysModified, 
                         ToSIC_SexyContent_ContentGroupItems.SysModifiedBy, ToSIC_SexyContent_ContentGroupItems.SysDeleted, 
                         ToSIC_SexyContent_ContentGroupItems.SysDeletedBy, ToSIC_SexyContent_Templates.AppID, ToSIC_EAV_Apps.ZoneID, 
                         ToSIC_EAV_Entities.EntityGUID, ToSIC_SexyContent_ContentGroupItems.EntityID, ToSIC_SexyContent_ContentGroupItems.Temp_NewContentGroupGuid, ToSIC_SexyContent_Templates.Temp_NewTemplateGuid
FROM            ToSIC_SexyContent_Templates INNER JOIN
                         ModuleSettings INNER JOIN
                         ToSIC_SexyContent_ContentGroupItems ON ModuleSettings.SettingValue = ToSIC_SexyContent_ContentGroupItems.ContentGroupID ON 
                         ToSIC_SexyContent_Templates.TemplateID = ToSIC_SexyContent_ContentGroupItems.TemplateID INNER JOIN
                         ToSIC_EAV_Apps ON ToSIC_SexyContent_Templates.AppID = ToSIC_EAV_Apps.AppID LEFT OUTER JOIN
                         ToSIC_EAV_Entities ON ToSIC_SexyContent_ContentGroupItems.EntityID = ToSIC_EAV_Entities.EntityID
WHERE        (ToSIC_SexyContent_ContentGroupItems.SysDeleted IS NULL) AND (ModuleSettings.SettingName = N'ContentGroupID') AND 
                         ((SELECT COUNT(*) FROM ToSIC_EAV_Entities WHERE EntityGUID = ToSIC_SexyContent_ContentGroupItems.Temp_NewContentGroupGuid) = 0) ORDER BY SortOrder";

            var adapterContentGroups = new SqlDataAdapter(sqlCommandContentGroups, sqlConnection);
            adapterContentGroups.SelectCommand.CommandTimeout = 3600;
            adapterContentGroups.Fill(contentGroupItemsTable);

            var contentGroupItems = contentGroupItemsTable.AsEnumerable().Select(c => new
            {
                ContentGroupId      = (int)c["ContentGroupID"],
                NewContentGroupGuid = Guid.Parse((string)c["Temp_NewContentGroupGuid"]),
                EntityId            = c["EntityID"] == DBNull.Value ? new int?() : (int)c["EntityID"],
                EntityGuid          = c["EntityGUID"] == DBNull.Value ? (Guid?)null : ((Guid)c["EntityGUID"]),
                TemplateId          = c["TemplateID"] == DBNull.Value ? new int?() : (int)c["TemplateID"],
                SortOrder           = (int)c["SortOrder"],
                Type   = (string)c["Type"],
                AppId  = (int)c["AppID"],
                ZoneId = (int)c["ZoneID"],
                TemplateEntityGuids = new List <Guid>()
                {
                    Guid.Parse((string)c["Temp_NewTemplateGuid"])
                }
            });

            var existingContentGroups = contentGroupItems.GroupBy(c => c.ContentGroupId, c => c, (id, items) =>
            {
                var itemsList    = items.ToList();
                var contentGroup = new
                {
                    NewEntityGuid = itemsList.First().NewContentGroupGuid,
                    itemsList.First().AppId,
                    itemsList.First().ZoneId,
                    ContentGroupId        = id,
                    TemplateGuids         = itemsList.First().TemplateEntityGuids,
                    ContentGuids          = itemsList.Where(p => p.Type == "Content").Select(p => p.EntityGuid).ToList(),
                    PresentationGuids     = itemsList.Where(p => p.Type == "Presentation").Select(p => p.EntityGuid).ToList(),
                    ListContentGuids      = itemsList.Where(p => p.Type == "ListContent").Select(p => p.EntityGuid).ToList(),
                    ListPresentationGuids = itemsList.Where(p => p.Type == "ListPresentation").Select(p => p.EntityGuid).ToList()
                };
                return(contentGroup);
            }).ToList();

            #endregion


            // Import all entities
            logger.LogStep("07.00.00", "2. Import all entities", false);
            var apps = existingTemplates.Select(p => p.AppId).ToList();
            apps.AddRange(existingContentGroups.Select(p => p.AppId));
            apps = apps.Distinct().ToList();

            foreach (var app in apps)
            {
                logger.LogStep("07.00.00", "Starting to migrate data for app " + app + "...");

                var currentApp       = app;
                var entitiesToImport = new List <ImportEntity>();

                foreach (var t in existingTemplates.Where(t => t.AppId == currentApp))
                {
                    var entity = new ImportEntity
                    {
                        AttributeSetStaticName = "2SexyContent-Template",
                        EntityGuid             = t.NewEntityGuid,
                        IsPublished            = true,
                        AssignmentObjectTypeId = ContentTypeHelpers.AssignmentObjectTypeIDDefault
                    };
                    entity.Values = new Dictionary <string, List <IValueImportModel> >
                    {
                        { "Name", new List <IValueImportModel> {
                              new ValueImportModel <string>(entity)
                              {
                                  Value = t.Name
                              }
                          } },
                        { "Path", new List <IValueImportModel> {
                              new ValueImportModel <string>(entity)
                              {
                                  Value = t.Path
                              }
                          } },
                        { "ContentTypeStaticName", new List <IValueImportModel> {
                              new ValueImportModel <string>(entity)
                              {
                                  Value = t.ContentTypeId
                              }
                          } },
                        { "ContentDemoEntity", new List <IValueImportModel> {
                              new ValueImportModel <List <Guid> >(entity)
                              {
                                  Value = t.ContentDemoEntityGuids
                              }
                          } },
                        { "PresentationTypeStaticName", new List <IValueImportModel> {
                              new ValueImportModel <string>(entity)
                              {
                                  Value = t.PresentationTypeId
                              }
                          } },
                        { "PresentationDemoEntity", new List <IValueImportModel> {
                              new ValueImportModel <List <Guid> >(entity)
                              {
                                  Value = t.PresentationDemoEntityGuids
                              }
                          } },
                        { "ListContentTypeStaticName", new List <IValueImportModel> {
                              new ValueImportModel <string>(entity)
                              {
                                  Value = t.ListContentTypeId
                              }
                          } },
                        { "ListContentDemoEntity", new List <IValueImportModel> {
                              new ValueImportModel <List <Guid> >(entity)
                              {
                                  Value = t.ListContentDemoEntityGuids
                              }
                          } },
                        { "ListPresentationTypeStaticName", new List <IValueImportModel> {
                              new ValueImportModel <string>(entity)
                              {
                                  Value = t.ListPresentationTypeId
                              }
                          } },
                        { "ListPresentationDemoEntity", new List <IValueImportModel> {
                              new ValueImportModel <List <Guid> >(entity)
                              {
                                  Value = t.ListPresentationDemoEntityGuids
                              }
                          } },
                        { "Type", new List <IValueImportModel> {
                              new ValueImportModel <string>(entity)
                              {
                                  Value = t.Type
                              }
                          } },
                        { "IsHidden", new List <IValueImportModel> {
                              new ValueImportModel <bool?>(entity)
                              {
                                  Value = t.IsHidden
                              }
                          } },
                        { "Location", new List <IValueImportModel> {
                              new ValueImportModel <string>(entity)
                              {
                                  Value = t.Location
                              }
                          } },
                        { "UseForList", new List <IValueImportModel> {
                              new ValueImportModel <bool?>(entity)
                              {
                                  Value = t.UseForList
                              }
                          } },
                        { "PublishData", new List <IValueImportModel> {
                              new ValueImportModel <bool?>(entity)
                              {
                                  Value = t.PublishData
                              }
                          } },
                        { "StreamsToPublish", new List <IValueImportModel> {
                              new ValueImportModel <string>(entity)
                              {
                                  Value = t.StreamsToPublish
                              }
                          } },
                        { "Pipeline", new List <IValueImportModel> {
                              new ValueImportModel <List <Guid> >(entity)
                              {
                                  Value = t.PipelineEntityGuids
                              }
                          } },
                        { "ViewNameInUrl", new List <IValueImportModel> {
                              new ValueImportModel <string>(entity)
                              {
                                  Value = t.ViewNameInUrl
                              }
                          } }
                    };
                    entitiesToImport.Add(entity);
                }

                foreach (var t in existingContentGroups.Where(t => t.AppId == app))
                {
                    var entity = new ImportEntity
                    {
                        AttributeSetStaticName = "2SexyContent-ContentGroup",
                        EntityGuid             = t.NewEntityGuid,
                        IsPublished            = true,
                        AssignmentObjectTypeId = ContentTypeHelpers.AssignmentObjectTypeIDDefault
                    };
                    entity.Values = new Dictionary <string, List <IValueImportModel> >
                    {
                        { "Template", new List <IValueImportModel> {
                              new ValueImportModel <List <Guid> >(entity)
                              {
                                  Value = t.TemplateGuids
                              }
                          } },
                        { "Content", new List <IValueImportModel> {
                              new ValueImportModel <List <Guid?> >(entity)
                              {
                                  Value = t.ContentGuids
                              }
                          } },
                        { "Presentation", new List <IValueImportModel> {
                              new ValueImportModel <List <Guid?> >(entity)
                              {
                                  Value = t.PresentationGuids
                              }
                          } },
                        { "ListContent", new List <IValueImportModel> {
                              new ValueImportModel <List <Guid?> >(entity)
                              {
                                  Value = t.ListContentGuids
                              }
                          } },
                        { "ListPresentation", new List <IValueImportModel> {
                              new ValueImportModel <List <Guid?> >(entity)
                              {
                                  Value = t.ListPresentationGuids
                              }
                          } }
                    };
                    entitiesToImport.Add(entity);
                }

                var import = new Eav.Import.Import(null, app, userName);
                import.RunImport(null, entitiesToImport);

                logger.LogStep("07.00.00", "Migrated data for app " + app);
            }
            logger.LogStep("07.00.00", "Done", false);
        }