本文整理汇总了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;
}
示例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);
}
}
示例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));
}
}
示例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;
}
示例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;
}
示例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;
}
示例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));
}
示例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());
}
示例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);
}
示例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));
}
示例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);
}
示例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);
}
示例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());
}
}
示例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;
}
示例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();
}