本文整理汇总了C#中Revision.CopyToNewRevision方法的典型用法代码示例。如果您正苦于以下问题:C# Revision.CopyToNewRevision方法的具体用法?C# Revision.CopyToNewRevision怎么用?C# Revision.CopyToNewRevision使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Revision
的用法示例。
在下文中一共展示了Revision.CopyToNewRevision方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CompositeEntity_ReSaves
public void CompositeEntity_ReSaves()
{
// Arrange
var childSchema = CreateAndSaveCompositeSchema(AttributeTypeRegistry, ProviderSetup);
CompositeEntitySchema merged = null;
var groupUnitFactory = new GroupUnitFactory(ProviderSetup, childSchema.Id.ToUri(), FakeHiveCmsManager.CreateFakeRepositoryContext(ProviderSetup.FrameworkContext));
using (var uow = groupUnitFactory.Create())
{
merged = uow.Repositories.Schemas.GetComposite<EntitySchema>(childSchema.Id);
}
List<TypedAttribute> attribs;
var entity = MockCompositeEntity(merged, out attribs);
AssignFakeIdsIfPassthrough(ProviderSetup.ProviderMetadata, entity);
Assert.That(entity.Attributes.Count, Is.EqualTo(attribs.Count));
var firstRevision = new Revision<TypedEntity>(entity);
using (var uow = groupUnitFactory.Create())
{
uow.Repositories.Revisions.AddOrUpdate(firstRevision);
uow.Complete();
}
PostWriteCallback.Invoke();
// Edit the data and resave
var secondRevision = firstRevision.CopyToNewRevision(FixedStatusTypes.Published);
secondRevision.Item.Attributes.Last().DynamicValue = "changed";
secondRevision.Item.Attributes.ForEach(x => x.Id = HiveId.Empty);
using (var uow = groupUnitFactory.Create())
{
uow.Repositories.Revisions.AddOrUpdate(secondRevision);
uow.Complete();
}
PostWriteCallback.Invoke();
// Load the data again to ensure these attributes are still "inherited"
using (var uow = groupUnitFactory.Create())
{
var reloaded = uow.Repositories.Get<TypedEntity>(entity.Id);
Assert.That(reloaded.EntitySchema.Id.Value, Is.EqualTo(childSchema.Id.Value));
Assert.That(reloaded.Attributes.Count, Is.EqualTo(attribs.Count));
Assert.That(reloaded.Attributes.Select(x => x.AttributeDefinition), Has.Some.TypeOf<InheritedAttributeDefinition>());
}
}