当前位置: 首页>>代码示例>>C#>>正文


C# IItemData类代码示例

本文整理汇总了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);
            }
        }
开发者ID:csteeg,项目名称:Rainbow,代码行数:29,代码来源:YamlItem.cs

示例2: EvaluateUpdate

        public virtual IItemData EvaluateUpdate(IItemData sourceItem, IItemData targetItem)
        {
            Assert.ArgumentNotNull(sourceItem, "sourceItemData");
            _logger.Evaluated(sourceItem);

            return null;
        }
开发者ID:PetersonDave,项目名称:Unicorn,代码行数:7,代码来源:NewItemOnlyEvaluator.cs

示例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;
			}
		}
开发者ID:hbopuri,项目名称:Unicorn,代码行数:29,代码来源:SerializationLoader.cs

示例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;
			}
		}
开发者ID:hbopuri,项目名称:Unicorn,代码行数:29,代码来源:SerializationHelper.cs

示例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;
        }
开发者ID:PetersonDave,项目名称:Unicorn,代码行数:30,代码来源:SerializationHelper.cs

示例6: PredicateFilteredItemData

        public PredicateFilteredItemData(IItemData innerItem, IPredicate predicate)
            : base(innerItem)
        {
            Assert.ArgumentNotNull(predicate, "predicate");

            _predicate = predicate;
        }
开发者ID:bllue78,项目名称:Unicorn,代码行数:7,代码来源:PredicateFilteredItemData.cs

示例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;
 }
开发者ID:adoprog,项目名称:Sitecore-Courier,代码行数:30,代码来源:RainbowDataItem.cs

示例8: AddTreeRetry

        public void AddTreeRetry(IItemData reference, Exception exception)
        {
            Assert.ArgumentNotNull(reference, "reference");
            Assert.ArgumentNotNull(exception, "exception");

            _treeFailures.Add(new Failure(reference, exception));
        }
开发者ID:bllue78,项目名称:Unicorn,代码行数:7,代码来源:DeserializeFailureRetryer.cs

示例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));
        }
开发者ID:bllue78,项目名称:Unicorn,代码行数:7,代码来源:DefaultSerializedAsMasterEvaluatorLogger.cs

示例10: AddProcessedItem

		public void AddProcessedItem(IItemData itemData)
		{
			lock (_syncRoot)
			{
				_duplicateChecks.Add(CreateKey(itemData), new DuplicateIdEntry(itemData));
			}
		}
开发者ID:hbopuri,项目名称:Unicorn,代码行数:7,代码来源:DuplicateIdConsistencyChecker.cs

示例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;
		}
开发者ID:OlegJytnik,项目名称:Rainbow,代码行数:12,代码来源:PathRebasingProxyItem.cs

示例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);
        }
开发者ID:bllue78,项目名称:Unicorn,代码行数:8,代码来源:SerializedAsMasterEvaluator.cs

示例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;
 }
开发者ID:haiyangIt,项目名称:Haiyang,代码行数:8,代码来源:CatalogItemArgs.cs

示例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();
        }
开发者ID:bllue78,项目名称:Unicorn,代码行数:8,代码来源:DefaultSerializedAsMasterEvaluatorLogger.cs

示例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);
		}
开发者ID:OlegJytnik,项目名称:Rainbow,代码行数:8,代码来源:SerializationFileSystemDataStore.cs


注:本文中的IItemData类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。