private IEnumerable <ICommandData> MigratePerson1ToPerson2(RavenJObject doc, RavenJObject metadata) { var name = doc.Value <string>("Name"); if (!string.IsNullOrEmpty(name)) { doc["FirstName"] = name.Split(' ')[0]; doc["LastName"] = name.Split(' ')[1]; } doc.Remove("Name"); metadata[Constants.RavenClrType] = "RavenMigrations.Tests.Person2, RavenMigrations.Tests"; var foobaz = new FooBaz { Id = 1, Bar = "loaded" }; var foobazDoc = RavenJObject.FromObject(foobaz); var meta = new RavenJObject(); meta[Constants.RavenEntityName] = "FooBazs"; var cmd = new PutCommandData { Document = foobazDoc, Key = "foobazs/" + foobaz.Id, Metadata = meta }; return(new[] { cmd }); }
private IEnumerable<ICommandData> MigratePerson1ToPerson2(RavenJObject doc, RavenJObject metadata) { var name = doc.Value<string>("Name"); if (!string.IsNullOrEmpty(name)) { doc["FirstName"] = name.Split(' ')[0]; doc["LastName"] = name.Split(' ')[1]; } doc.Remove("Name"); metadata[Constants.RavenClrType] = "RavenMigrations.Tests.Person2, RavenMigrations.Tests"; var foobaz = new FooBaz { Id = 1, Bar = "loaded" }; var foobazDoc = RavenJObject.FromObject(foobaz); var meta = new RavenJObject(); meta[Constants.RavenEntityName] = "FooBazs"; var cmd = new PutCommandData { Document = foobazDoc, Key = "foobazs/" + foobaz.Id, Metadata = meta }; return new[] {cmd}; }