public override MigrationResult Migrate(DatabaseStatus preSchemaUpdateStatus)
        {
            using (var tx = persister.Repository.BeginTransaction())
            {
                var result = new MigrationResult(this); ;
				foreach (var redirect in persister.Repository.Find(new Parameter("class", "Redirect")).Where(p => p.Parent is Models.Pages.LanguageRoot))
                {
                    persister.Delete(redirect);
                    result.UpdatedItems++;
                }
                tx.Commit();
                return result;
            }
        }
		public override MigrationResult Migrate(DatabaseStatus preSchemaUpdateStatus)
		{
			var events = GetEvents().ToList();
			var result = new MigrationResult(this); ;
			using (var tx = persister.Repository.BeginTransaction())
			{
				foreach (var ev in events.OfType<Event>())
				{
					ev.EventDate = ev.GetDetail<DateTime?>("EventDate", null);
					persister.Save(ev);
					result.UpdatedItems++;
				}
				tx.Commit();
				return result;
			}
		}
 public override MigrationResult Migrate(DatabaseStatus preSchemaUpdateStatus)
 {
     var parts = persister.Repository.Find(new Parameter("class", "Top")).ToList();
     var result = new MigrationResult(this); ;
     using (var tx = persister.Repository.BeginTransaction())
     {
         foreach (var part in parts.Where(p => p.State != ContentState.Deleted).Where(p => p.Parent != null))
         {
             part.Parent.StoreEmbeddedPart("Header", part);
             persister.Save(part.Parent);
             persister.Delete(part);
             result.UpdatedItems++;
         }
         tx.Commit();
         return result;
     }
 }
Example #4
0
 public override MigrationResult Migrate(DatabaseStatus preSchemaUpdateStatus)
 {
     var events = GetNews().Union(GetEvents()).ToList();
     var result = new MigrationResult(this); ;
     using (var tx = persister.Repository.BeginTransaction())
     {
         foreach (var ev in events.OfType<ContentPageBase>())
         {
             var intro = ev.GetDetail<string>("Introduction", null);
             if (intro != null)
             {
                 ev.SetDetail("Introduction", null, typeof(string));
                 ev.Summary = intro;
                 persister.Save(ev);
                 result.UpdatedItems++;
             }
         }
         tx.Commit();
         return result;
     }
 }