本文整理汇总了C#中IPersister.Save方法的典型用法代码示例。如果您正苦于以下问题:C# IPersister.Save方法的具体用法?C# IPersister.Save怎么用?C# IPersister.Save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IPersister
的用法示例。
在下文中一共展示了IPersister.Save方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetUp
public override void SetUp()
{
base.SetUp();
persister = TestSupport.SetupFakePersister();
persister.Save(root);
}
示例2: SetUp
public override void SetUp()
{
base.SetUp();
//definitions = TestSupport.SetupDefinitions(typeof(NormalPage), typeof(NormalItem));
//persister = TestSupport.SetupFakePersister();
definitions = engine.Definitions;
persister = engine.Persister;
page = CreateOneItem<NormalPage>(0, "root", null);
persister.Save(page);
worker = new EditableItemMigration(definitions, persister.Repository);
}
示例3: SetUp
public override void SetUp()
{
base.SetUp();
finder = new FakeTypeFinder(typeof(XmlableItem).Assembly, typeof(XmlableItem), typeof(XmlableItem2));
notifier = mocks.Stub<IItemNotifier>();
mocks.Replay(notifier);
definitions = new DefinitionManager(
new DefinitionBuilder(
finder,
new EngineSection(),
new FakeEditUrlManager()),
new N2.Edit.Workflow.StateChanger(),
notifier,
new InterceptingProxyFactory());
parser = mocks.StrictMock<IUrlParser>();
Expect.On(parser)
.Call(parser.BuildUrl(null))
.IgnoreArguments()
.Do(new BuildUrl(delegate(ContentItem itemToBuild)
{
string url = "/" + itemToBuild.Name + ".aspx";
foreach (ContentItem parent in Find.EnumerateParents(itemToBuild, null))
{
if (parent.Parent != null)
url = "/" + parent.Name + url;
}
return url;
}))
.Repeat.Any();
mocks.Replay(parser);
persister = mocks.StrictMock<IPersister>();
persister.Save(null);
LastCall.IgnoreArguments().Repeat.Any();
mocks.Replay(persister);
}
示例4: AddAnswer
public virtual void AddAnswer(IPersister persister, int selectedItem)
{
Option o = persister.Get<Option>(selectedItem);
o.Answers++;
persister.Save(o);
}
示例5: Unpublish
/// <summary>
/// Used by Edit.aspx
/// </summary>
/// <param name="persister"></param>
/// <param name="item"></param>
public static void Unpublish(IPersister persister, ContentItem item)
{
if (!item.IsPage)
throw new ArgumentException("Unpublish requires item to be page");
var stateChanger = Context.Current.Resolve<StateChanger>();
stateChanger.ChangeTo(item, ContentState.Unpublished);
persister.Save(item);
}
示例6: Publish
/// <summary>
/// Used by PublishScheduledAction and the Publish Button in the Curtain
/// </summary>
/// <param name="versionManager"></param>
/// <param name="persister"></param>
/// <param name="previewedItem"></param>
/// <returns></returns>
public static ContentItem Publish(this IVersionManager versionManager, IPersister persister, ContentItem previewedItem)
{
//if (previewedItem.State == ContentState.Published)
// return previewedItem; // nothing to do
if (!previewedItem.IsPage)
throw new ArgumentException("Publish requires item to be a page");
if (previewedItem.VersionOf.HasValue)
{
// is versioned
previewedItem = versionManager.MakeMasterVersion(previewedItem);
persister.Save(previewedItem);
}
var stateChanger = Context.Current.Resolve<StateChanger>();
stateChanger.ChangeTo(previewedItem, ContentState.Published);
persister.Save(previewedItem);
return previewedItem;
}