本文整理汇总了C#中IItemData类的典型用法代码示例。如果您正苦于以下问题:C# IItemData类的具体用法?C# IItemData怎么用?C# IItemData使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IItemData类属于命名空间,在下文中一共展示了IItemData类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LoadFrom
public virtual void LoadFrom(IItemData itemData, IFieldFormatter[] fieldFormatters)
{
Id = itemData.Id;
DatabaseName = itemData.DatabaseName;
ParentId = itemData.ParentId;
TemplateId = itemData.TemplateId;
Path = itemData.Path;
BranchId = itemData.BranchId;
foreach (var field in itemData.SharedFields)
{
var fieldObject = new YamlFieldValue();
fieldObject.LoadFrom(field, fieldFormatters);
SharedFields.Add(fieldObject);
}
var languages = itemData.Versions.GroupBy(x => x.Language.Name);
foreach (var language in languages)
{
var languageObject = new YamlLanguage();
languageObject.LoadFrom(language, fieldFormatters);
if(languageObject.Versions.Count > 0)
Languages.Add(languageObject);
}
}
示例2: EvaluateUpdate
public virtual IItemData EvaluateUpdate(IItemData sourceItem, IItemData targetItem)
{
Assert.ArgumentNotNull(sourceItem, "sourceItemData");
_logger.Evaluated(sourceItem);
return null;
}
示例3: LoadAll
public virtual void LoadAll(IItemData[] rootItemsData, IDeserializeFailureRetryer retryer, IConsistencyChecker consistencyChecker, Action<IItemData> rootLoadedCallback = null)
{
Assert.ArgumentNotNull(rootItemsData, "rootItems");
Assert.IsTrue(rootItemsData.Length > 0, "No root items were passed!");
CacheManager.ClearAllCaches(); // BOOM! This clears all caches before we begin;
// because for a TpSync configuration we could have TpSync items in the data cache which 'taint' the item comparisons and result in missed updates
bool disableNewSerialization = UnicornDataProvider.DisableSerialization;
try
{
UnicornDataProvider.DisableSerialization = true;
using (new EventDisabler())
{
foreach (var rootItem in rootItemsData)
{
LoadTree(rootItem, retryer, consistencyChecker);
if (rootLoadedCallback != null) rootLoadedCallback(rootItem);
}
retryer.RetryAll(SourceDataStore, item => DoLoadItem(item, null), item => LoadTreeInternal(item, retryer, null));
}
}
finally
{
UnicornDataProvider.DisableSerialization = disableNewSerialization;
}
}
示例4: DumpItem
/// <returns>True if the item was dumped, false if it was not included</returns>
public virtual bool DumpItem(IItemData item, IConfiguration[] configurations = null)
{
using (new TransparentSyncDisabler())
{
if (configurations == null) configurations = GetConfigurationsForItem(item);
foreach(var configuration in configurations)
{
if (configuration == null) return false;
var predicate = configuration.Resolve<IPredicate>();
var serializationStore = configuration.Resolve<ITargetDataStore>();
CacheManager.ClearAllCaches(); // BOOM! This clears all caches before we begin;
// because for a TpSync configuration we could have TpSync items in the data cache which 'taint' the reserialize
// from being purely database
var result = DumpItemInternal(item, predicate, serializationStore).IsIncluded;
CacheManager.ClearAllCaches(); // BOOM! And we clear everything again at the end, because now
// for a TpSync configuration we might have DATABASE items in cache where we want TpSync.
if (!result) return false;
}
return true;
}
}
示例5: DumpTree
/// <returns>True if the tree was dumped, false if the root item was not included</returns>
public virtual bool DumpTree(IItemData item, IConfiguration configuration = null)
{
using (new TransparentSyncDisabler())
{
if(configuration == null) configuration = GetConfigurationForItem(item);
if (configuration == null) return false;
var logger = configuration.Resolve<ILogger>();
var predicate = configuration.Resolve<IPredicate>();
var serializationStore = configuration.Resolve<ITargetDataStore>();
var sourceStore = configuration.Resolve<ISourceDataStore>();
var rootReference = serializationStore.GetByPathAndId(item.Path, item.Id, item.DatabaseName);
if (rootReference != null)
{
logger.Warn("[D] existing serialized items under {0}".FormatWith(rootReference.GetDisplayIdentifier()));
serializationStore.Remove(rootReference);
}
logger.Info("[U] Serializing included items under root {0}".FormatWith(item.GetDisplayIdentifier()));
if (!predicate.Includes(item).IsIncluded) return false;
DumpTreeInternal(item, predicate, serializationStore, sourceStore, logger);
}
return true;
}
示例6: PredicateFilteredItemData
public PredicateFilteredItemData(IItemData innerItem, IPredicate predicate)
: base(innerItem)
{
Assert.ArgumentNotNull(predicate, "predicate");
_predicate = predicate;
}
示例7: BuildSyncItem
public SyncItem BuildSyncItem(IItemData item)
{
var syncItem = new SyncItem
{
ID = item.Id.ToString("B"),
DatabaseName = item.DatabaseName,
ParentID = item.ParentId.ToString("B"),
Name = item.Name,
BranchId = item.BranchId.ToString("B"),
TemplateID = item.TemplateId.ToString("B"),
ItemPath = item.Path
};
//syncItem.TemplateName = item.TemplateName;
foreach (var field in item.SharedFields) //TODO: ItemSynchronization.BuildSyncItem sorts the fields and versions first, should we ?
{
syncItem.AddSharedField(field.FieldId.ToString("B"), null/*name*/, null/*key?*/, field.Value, true);
}
foreach (var version in item.Versions)
{
var syncVersion = syncItem.AddVersion(version.Language.ToString(), version.VersionNumber.ToString(), version.VersionNumber.ToString() /*revisionid needed?*/);
if (syncVersion != null)
{
foreach (var field in version.Fields)
{
syncVersion.AddField(field.FieldId.ToString("B"), null/*name*/,null /*key?*/, field.Value, true);
}
}
}
return syncItem;
}
示例8: AddTreeRetry
public void AddTreeRetry(IItemData reference, Exception exception)
{
Assert.ArgumentNotNull(reference, "reference");
Assert.ArgumentNotNull(exception, "exception");
_treeFailures.Add(new Failure(reference, exception));
}
示例9: Renamed
public virtual void Renamed(IItemData sourceItem, IItemData targetItem)
{
Assert.ArgumentNotNull(sourceItem, "sourceItem");
Assert.ArgumentNotNull(targetItem, "targetItem");
_logger.Debug("> Name: Serialized \"{0}\", Source \"{1}\"".FormatWith(targetItem.Name, sourceItem.Name));
}
示例10: AddProcessedItem
public void AddProcessedItem(IItemData itemData)
{
lock (_syncRoot)
{
_duplicateChecks.Add(CreateKey(itemData), new DuplicateIdEntry(itemData));
}
}
示例11: PathRebasingProxyItem
/// <summary>
/// Creates a rebasing based on an item, new PARENT path, and new parent ID. Use this to rebase an individual item
/// that may not yet have the right parent and path.
/// </summary>
public PathRebasingProxyItem(IItemData innerItem, string newParentPath, Guid newParentId) : base(innerItem)
{
Assert.ArgumentNotNull(innerItem, "innerItem");
Assert.ArgumentNotNull(newParentPath, "newParentPath");
_newParentPath = newParentPath;
ParentId = newParentId;
}
示例12: EvaluateOrphans
public void EvaluateOrphans(IItemData[] orphanItems)
{
Assert.ArgumentNotNull(orphanItems, "orphanItems");
EvaluatorUtility.RecycleItems(orphanItems, _sourceDataStore, item => _logger.DeletedItem(item));
foreach (var orphan in orphanItems) _logger.Evaluated(orphan);
}
示例13: CatalogItemArgs
public CatalogItemArgs(CatalogItemProgressType type, IMailboxData mailbox, Stack<IFolderData> folderStack, IFolderData folder, IItemData currentItem)
{
this.Type = type;
this.Mailbox = mailbox;
this.FolderStack = folderStack;
this.Folder = folder;
this.CurrentItem = currentItem;
}
示例14: SerializedUpdatedItem
public virtual void SerializedUpdatedItem(IItemData targetItem)
{
Assert.ArgumentNotNull(targetItem, "targetItem");
_logger.Info("[U] {0}".FormatWith(targetItem.GetDisplayIdentifier()));
_pipelineDataCollector.PushChangedItem(targetItem, ChangeType.Modified);
_pipelineDataCollector.AddProcessedItem();
}
示例15: Save
public virtual void Save(IItemData item)
{
var tree = GetTreeForPath(item.Path, item.DatabaseName);
if (tree == null) throw new InvalidOperationException("No trees contained the global path " + item.Path);
tree.Save(item);
}