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


C# ID.ToString方法代码示例

本文整理汇总了C#中ID.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# ID.ToString方法的具体用法?C# ID.ToString怎么用?C# ID.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ID的用法示例。


在下文中一共展示了ID.ToString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetItem

		public SyncItem GetItem(ID id)
		{
			Assert.ArgumentNotNull(id, "id");

			SyncItem resultItem;
			if (!_idLookup.TryGetValue(id, out resultItem))
			{
				lock (_idLookupLock)
				{
					if (!_idLookup.TryGetValue(id, out resultItem))
					{
						string stringId = id.ToString();
						SyncItem item = _innerItems.Find(x => x.ID == stringId);
						if (item != null)
						{
							_idLookup.Add(id, item);
						}

						return item;
					}
				}
			}

			return resultItem;
		}
开发者ID:Vittel,项目名称:Rhino,代码行数:25,代码来源:SerializedIndex.cs

示例2: MoveToStateAndExecuteActions

        /// <summary>
        /// Move an item to a particular workflow state
        /// </summary>
        /// <param name="item">The item to go through workflow</param>
        /// <param name="workflowStateId">The ID of the workflow state</param>
        public void MoveToStateAndExecuteActions(Item item, ID workflowStateId)
        {
            IWorkflowProvider workflowProvider = item.Database.WorkflowProvider;
            IWorkflow workflow = workflowProvider.GetWorkflow(item);

            // if item is in any workflow
            if (workflow != null)
            {
                using (new EditContext(item))
                {
                    // update item's state to the new one
                    item[FieldIDs.WorkflowState] = workflowStateId.ToString();
                }

                Item stateItem = ItemManager.GetItem(workflowStateId, Language.Current, Version.Latest, item.Database, SecurityCheck.Disable);

                // if there are any actions for the new state
                if (!stateItem.HasChildren)
                    return;

                // TODO: Obsolete constructor
                var workflowPipelineArgs = new WorkflowPipelineArgs(item, string.Empty, null);

                // start executing the actions
                Pipeline pipeline = Pipeline.Start(stateItem, workflowPipelineArgs);
                if (pipeline == null)
                    return;

                // TODO: Obsolete class
                WorkflowCounters.ActionsExecuted.IncrementBy(pipeline.Processors.Count);
            }
        }
开发者ID:BIGANDYT,项目名称:spitfire-vitality,代码行数:37,代码来源:DeployMarketingAssets.ashx.cs

示例3: RemoveItemField

        public override void RemoveItemField(Item item, ID fieldID)
        {
            // With the LateralFieldFallbackProcessor, we need to clear that cache of a field that references this field too.
            FallbackItem fieldItem = item;

            if (fieldItem != null && fieldItem.HasLateralFallback)
            {
                List<ID> fieldsThatFallbackToMe = fieldItem.GetFieldsThatFallbackTo(item.Fields[fieldID]).ToList();
                foreach (ID v in fieldsThatFallbackToMe)
                {
                    Remove(GetFieldKey(item, v));
                }
            }

            if (ClearChildEntries)
            {
                // we need to clear all child items that have this field
                // get cache keys for all items in this subtree
                List<string> keys = base.InnerCache.GetCacheKeys(GetGeneralItemKeyPrefix(item)).Cast<string>().ToList();
                string sfieldID = fieldID.ToString();
                foreach (string key in keys)
                {
                    // if this key contains the field, then clear it
                    if (key.Contains(sfieldID))
                    {
                        base.Remove(key);
                    }
                }
            }
            else
            {
                base.Remove(GetFieldKey(item, fieldID));
            }
        }
开发者ID:hhog-tkamin,项目名称:sitecore-field-fallback,代码行数:34,代码来源:FallbackValuesCache.cs

示例4: GenerateIdForFacetMemberValue

 public static ID GenerateIdForFacetMemberValue(string memberValue, string memberDescription, ID parentId, ID templateId)
 {
     var prefix = "facet-member-value";
     var id = GenerateIdForValue(prefix, memberValue);
     var customData = string.Format("templateId={0}|description={1}", templateId.ToString(), memberDescription);
     UpdateOrCreateIDTableEntry(prefix, memberValue, id, parentId, customData);
     return id;
 }
开发者ID:rhamille,项目名称:sitecore-contact-utilities,代码行数:8,代码来源:IDTableHelper.cs

示例5: GenerateIdForFacetMember

 public static ID GenerateIdForFacetMember(MemberInfo memberInfo, ID parentId, ID templateId)
 {
     var prefix = "facet-member";
     var id = GenerateIdForValue(prefix, string.Format("{0}-{1}", memberInfo.Name, parentId.ToString()));
     var customData = string.Format("templateId={0}", templateId.ToString());
     UpdateOrCreateIDTableEntry(prefix, memberInfo.Name, id, parentId, customData);
     return id;
 }
开发者ID:rhamille,项目名称:sitecore-contact-utilities,代码行数:8,代码来源:IDTableHelper.cs

示例6: GenerateIdForFacet

 public static ID GenerateIdForFacet(string facetName, ID parentId, ID templateId)
 {
     var prefix = "facet";
     var id = GenerateIdForValue(prefix, facetName);
     var customData = string.Format("templateId={0}", templateId.ToString());
     UpdateOrCreateIDTableEntry(prefix, facetName, id, parentId, customData);
     return id;
 }
开发者ID:rhamille,项目名称:sitecore-contact-utilities,代码行数:8,代码来源:IDTableHelper.cs

示例7: OpenNewWindow

 private void OpenNewWindow(ID id, string name)
 {
     Assert.ArgumentNotNull(id, "id");
     UrlString url = new UrlString(Constants.Url.ExportFromDataPage);
     url.Append(Constants.QueryString.Name.ItemId, HttpContext.Current.Server.UrlEncode(id.ToString()));
     url.Append(Constants.QueryString.Name.ItemName, HttpContext.Current.Server.UrlEncode(name));
     SheerResponse.Eval(string.Format("window.open('{0}');", url));
 }
开发者ID:ptiemann,项目名称:WFFM-SQL-Server-SaveToDatabase,代码行数:8,代码来源:ExportFormDataCommand.cs

示例8: GlassController_can_set_and_get_datasource

        public void GlassController_can_set_and_get_datasource()
        {
            // Arrange
            ID expectedId = new ID(Guid.NewGuid());
            StubClass classToReturn = new StubClass();
            var testHarness = new SingleTypedGlassControllerTestHarness();
            testHarness.RenderingContextWrapper.HasDataSource.Returns(true);
            testHarness.RenderingContextWrapper.GetDataSource().Returns(expectedId.ToString());
            testHarness.SitecoreContext.GetItem<StubClass>(expectedId.ToString()).Returns(classToReturn);

            // Act
            var result1 = testHarness.GlassController.DataSource;
            var result2 = testHarness.GlassController.DataSource;

            // Assert
            result1.Should().Be(classToReturn);
            result2.Should().BeSameAs(result1);
            testHarness.SitecoreContext.Received(1).GetItem<StubClass>(expectedId.ToString());
        }
开发者ID:neilduncan,项目名称:Glass.Mapper,代码行数:19,代码来源:SingleTypedGlassController.cs

示例9: Schedule

 public Schedule(ID id)
 {
     Frequency = 0;
      Recurrence = Recurrence.Once;
      Sequence = Sequence.None;
      DaysOfWeek = DaysCollection.None;
      Month = Month.None;
      ID = id.ToString();
      _sourceItem = StaticSettings.EventSourceDatabase.Database.Items[id];
      loadRecurrence(_sourceItem);
 }
开发者ID:Refactored,项目名称:SitecoreCalendarModule,代码行数:11,代码来源:Schedule.cs

示例10: GetItemDefinition

        public override ItemDefinition GetItemDefinition(ID itemId, CallContext context)
        {
            var database = GetDatabase(context);
            var syncItem = database.GetItem(itemId.ToString());

            if (syncItem == null)
            {
                return ItemDefinition.Empty;
            }

            return new ItemDefinition(itemId, syncItem.Name, ID.Parse(syncItem.TemplateID), ID.Parse(syncItem.BranchId));
        }
开发者ID:kamsar,项目名称:SitecoreData,代码行数:12,代码来源:_old_SerializationDataProvider.cs

示例11: Execute_OutcomeID_RegisterOutcome

    public void Execute_OutcomeID_RegisterOutcome(Db db, ID outcomeId, [Frozen] ITrackerService trackerService, [Greedy] RegisterOutcome registerOutcome)
    {
      //Arrange
      db.Add(new DbItem("WrongOutcome", outcomeId, Templates.Outcome.ID));
      registerOutcome.Outcome = outcomeId.ToString();

      //Act
      registerOutcome.Execute(ID.Null, null);

      //Assert
      trackerService.Received().TrackOutcome(outcomeId);
    }
开发者ID:alinulms,项目名称:Habitat,代码行数:12,代码来源:RegisterOutcomeTests.cs

示例12: ShouldTryToSetFieldIdFromParsedNameIfItIsId

    public void ShouldTryToSetFieldIdFromParsedNameIfItIsId(FieldNamingHelper sut, ID id)
    {
      // arrange
      var name = id.ToString();

      // act
      var result = sut.GetFieldIdNamePair(ID.Null, name);

      // assert
      result.Key.Should().Be(id);
      result.Value.Should().Be(name);
    }
开发者ID:JRondeau16,项目名称:Sitecore.FakeDb,代码行数:12,代码来源:FieldNamingHelperTest.cs

示例13: SwapMultilistFieldValue

        private void SwapMultilistFieldValue(Item item, MultilistField field, ID targetItemId, ID newItemId)
        {
            Assert.ArgumentNotNull(item, "item");
            Assert.ArgumentNotNull(field, "field");
            Assert.ArgumentNotNull(targetItemId, "targetItemId");
            Assert.ArgumentNotNull(newItemId, "newItemId");

            using (new Sitecore.Data.Items.EditContext(item))
            {
                field.Remove(targetItemId.ToString());
                field.Add(newItemId.ToString());
            }
        }
开发者ID:PetersonDave,项目名称:Beacon,代码行数:13,代码来源:ContentModifierExample.cs

示例14: GetAssignConflict

    protected IEnumerable<ID> GetAssignConflict(ID tagId)
    {
      Database currentDb = Sitecore.Context.ContentDatabase ?? Sitecore.Context.Database;
      if (currentDb != null)
      {
        string query = string.Format("/sitecore/content/classification/taxonomies//*[contains(@ConflictTags,'{0}')]",
          tagId.ToString());

        return currentDb.SelectItems(query).Select(item => item.ID);
      }

      return null;
    }
开发者ID:aokour,项目名称:sitecore.taxonomy,代码行数:13,代码来源:TagSynchronization.cs

示例15: GetSetting

        public static WildcardSetting GetSetting(ID templateId)
        {
            var folder = GetWildcardSettingsFolder(Sitecore.Context.Site.SiteInfo);
            if(folder == null)
            {
                return null;
            }

            var settings = folder.GetChildren(Collections.ChildListOptions.SkipSorting);
            return settings.Where(setting => setting[AppConstants.WildcardSettingDatasourceTemplateField] == templateId.ToString())
                .Select(setting => new WildcardSetting(setting))
                .FirstOrDefault();
        }
开发者ID:cvandeluitgaarden,项目名称:Sitecore.SharedSource.Wildcard,代码行数:13,代码来源:WildcardProvider.cs


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