• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# IItemData类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中IItemData的典型用法代码示例。如果您正苦于以下问题:C# IItemData类的具体用法?C# IItemData怎么用?C# IItemData使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



IItemData类属于命名空间,在下文中一共展示了IItemData类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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


示例16: Deserialize

        public IItemData Deserialize(IItemData serializedItemData)
        {
            Assert.ArgumentNotNull(serializedItemData, "serializedItem");

            bool newItemWasCreated;
            var targetItem = GetOrCreateTargetItem(serializedItemData, out newItemWasCreated);

            var softErrors = new List<TemplateMissingFieldException>();

            try
            {
                ChangeTemplateIfNeeded(serializedItemData, targetItem);

                RenameIfNeeded(serializedItemData, targetItem);

                ResetTemplateEngineIfItemIsTemplate(targetItem);

                UpdateFieldSharingIfNeeded(serializedItemData, targetItem);

                PasteSharedFields(serializedItemData, targetItem, newItemWasCreated, softErrors);

                ClearCaches(targetItem.Database, new ID(serializedItemData.Id));

                targetItem.Reload();

                ResetTemplateEngineIfItemIsTemplate(targetItem);

                PasteVersions(serializedItemData, targetItem, newItemWasCreated, softErrors);

                ClearCaches(targetItem.Database, targetItem.ID);

                if (softErrors.Count > 0) throw TemplateMissingFieldException.Merge(softErrors);

                return new ItemData(targetItem, ParentDataStore);
            }
            catch (ParentForMovedItemNotFoundException)
            {
                throw;
            }
            catch (ParentItemNotFoundException)
            {
                throw;
            }
            catch (TemplateMissingFieldException)
            {
                throw;
            }
            catch (Exception ex)
            {
                if (newItemWasCreated)
                {
                    targetItem.Delete();
                    ClearCaches(targetItem.Database, new ID(serializedItemData.Id));
                }

                throw new DeserializationException("Failed to paste item: " + serializedItemData.Path, ex);
            }
        }
开发者ID:JeffDarchuk,项目名称:Rainbow,代码行数:58,代码来源:DefaultDeserializer.cs


示例17: IsConsistent

        public bool IsConsistent(IItemData itemData)
        {
            DuplicateIdEntry duplicateItemData;
            if(!_duplicateChecks.TryGetValue(CreateKey(itemData), out duplicateItemData)) return true;

            _logger.DuplicateFound(duplicateItemData, itemData);

            return false;
        }
开发者ID:bllue78,项目名称:Unicorn,代码行数:9,代码来源:DuplicateIdConsistencyChecker.cs


示例18: Convert

 public IItemData Convert(IItemData itemData, byte[] data)
 {
     return new ItemModel()
     {
         ItemId = itemData.ItemId,
         Data = data,
         Location = itemData.Location
     };
 }
开发者ID:haiyangIt,项目名称:Haiyang,代码行数:9,代码来源:DataConvertFromDb.cs


示例19: EvaluateOrphans

        public override void EvaluateOrphans(IItemData[] orphanItems)
        {
            Assert.ArgumentNotNull(orphanItems, "orphanItems");

            foreach (var item in orphanItems)
            {
                RecycleItem(item);
            }
        }
开发者ID:PetersonDave,项目名称:Unicorn,代码行数:9,代码来源:SerializedAsMasterEvaluator.cs


示例20: RecycleItem

        /// <summary>
        /// Deletes an item from the source data provider
        /// </summary>
        private static void RecycleItem(IItemData itemData, ISourceDataStore sourceStore, Action<IItemData> deleteMessage)
        {
            var children = sourceStore.GetChildren(itemData);

            RecycleItems(children, sourceStore, deleteMessage);

            deleteMessage(itemData);

            sourceStore.Remove(itemData);
        }
开发者ID:bllue78,项目名称:Unicorn,代码行数:13,代码来源:EvaluatorUtility.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IItemRepository类代码示例发布时间:2022-05-24
下一篇:
C# IItem类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap