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


C# ID.ToShortID方法代码示例

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


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

示例1: ShouldAddFieldById

    public void ShouldAddFieldById([NoAutoProperties]DbTemplate template, ID fieldId)
    {
      template.Add(fieldId);

      template.Fields[fieldId].Should().NotBeNull();
      template.Fields[fieldId].Name.Should().Be(fieldId.ToShortID().ToString());
    }
开发者ID:pveller,项目名称:Sitecore.FakeDb,代码行数:7,代码来源:DbTemplateTest.cs

示例2: DbItem

 /// <summary>
 /// Initializes a new instance of the <see cref="DbItem"/> class.
 /// </summary>
 /// <param name="name">The item name.</param>
 /// <param name="id">The item id.</param>
 /// <param name="templateId">The template id.</param>
 public DbItem(string name, ID id, ID templateId)
 {
   this.Name = !string.IsNullOrEmpty(name) ? name : id.ToShortID().ToString();
   this.ID = id;
   this.TemplateID = templateId;
   this.Access = new DbItemAccess();
   this.Fields = new DbFieldCollection();
   this.Children = new DbItemChildCollection(this);
   this.versionsCount = new Dictionary<string, int>();
 }
开发者ID:pveller,项目名称:Sitecore.FakeDb,代码行数:16,代码来源:DbItem.cs

示例3: AddCurrentBaseLayout_WithCurrentBaseLayoutIdNotNull_AddsQueryStringParameter

        public void AddCurrentBaseLayout_WithCurrentBaseLayoutIdNotNull_AddsQueryStringParameter()
        {
            // Arrange
            var urlString = new UrlString();
            var id = new ID();
            var options = new SelectBaseLayoutOptions {CurrentBaseLayoutId = id};

            // Act
            var result = options.AddCurrentBaseLayout(urlString);

            // Assert
            Assert.Equal(id.ToShortID().ToString(), result.Parameters[SelectBaseLayoutOptions.CurrentBaseLayoutQueryKey]);
        }
开发者ID:BenGGolden,项目名称:Sitecore.BaseLayouts,代码行数:13,代码来源:SelectBaseLayoutOptionsTests.cs

示例4: ParseCurrentBaseLayout_WithValidQueryString_SetsCurrentBaseLayoutId

        public void ParseCurrentBaseLayout_WithValidQueryString_SetsCurrentBaseLayoutId()
        {
            // Arrange
            var id = new ID();
            var options = Substitute.ForPartsOf<SelectBaseLayoutOptions>();
            options.When(o => o.GetQueryString(Arg.Any<string>())).DoNotCallBase();
            options.GetQueryString(SelectBaseLayoutOptions.CurrentBaseLayoutQueryKey).Returns(id.ToShortID().ToString());

            // Act
            options.ParseCurrentBaseLayout();

            // Assert
            Assert.Equal(id, options.CurrentBaseLayoutId);
        }
开发者ID:BenGGolden,项目名称:Sitecore.BaseLayouts,代码行数:14,代码来源:SelectBaseLayoutOptionsTests.cs

示例5: GetFieldIdNamePair

    public KeyValuePair<ID, string> GetFieldIdNamePair(ID id, string name)
    {
      if (string.IsNullOrEmpty(name))
      {
        name = WellknownFields.ContainsKey(id) ? WellknownFields[id] : id.ToShortID().ToString();
      }

      if (!ID.IsNullOrEmpty(id))
      {
        return new KeyValuePair<ID, string>(id, name);
      }

      var keyValuePair = WellknownFields.FirstOrDefault(kvp => kvp.Value == name);
      var newId = !ID.IsNullOrEmpty(keyValuePair.Key) ? keyValuePair.Key : ID.NewID;

      return new KeyValuePair<ID, string>(newId, name);
    }
开发者ID:maxshell,项目名称:Sitecore.FakeDb,代码行数:17,代码来源:FieldNamingHelper.cs

示例6: DbItem

    public DbItem(string name, ID id, ID templateId, params object[] children)
    {
      this.Name = !string.IsNullOrEmpty(name) ? name : id.ToShortID().ToString();
      this.ID = id;
      this.TemplateID = templateId;
      this.Access = new DbItemAccess();
      this.Fields = new DbFieldCollection();
      this.Children = new DbItemChildCollection(this);
      this.VersionsCount = new Dictionary<string, int>();

      if (children != null)
      {
        var items = children.OfType<DbItem>();
        foreach (var item in items)
        {
          this.Add(item);
        }
      }
    }
开发者ID:maxshell,项目名称:Sitecore.FakeDb,代码行数:19,代码来源:DbItem.cs

示例7: TransformValue

 /// <summary>
 /// Transforms a value for use in the index
 /// </summary>
 /// <param name="id">The ID to transform</param>
 /// <returns>A value suitable for usage with the index</returns>
 protected virtual string TransformValue(ID id)
 {
     return id.ToShortID().ToString().ToLower();
 }
开发者ID:jakebz33,项目名称:WeBlog,代码行数:9,代码来源:DatabaseCrawler.cs

示例8: VariableValueItemStub

 // Methods
 public VariableValueItemStub(ID id, string name)
 {
     Assert.ArgumentNotNull(id, "id");
     Assert.ArgumentNotNull(name, "name");
     Datasource = string.Empty;
     HideComponent = false;
     ReplacementComponent = string.Empty;
     Name = name;
     this.id = id.ToShortID().ToString();
 }
开发者ID:Velir,项目名称:Sitecore-Analytics,代码行数:11,代码来源:SetTestDetailsForm.cs

示例9: SutGeneratesNameBasedOnIdIfNotSet

 public void SutGeneratesNameBasedOnIdIfNotSet(ID id)
 {
   var sut = new DbItem(null, id);
   sut.Name.Should().Be(id.ToShortID().ToString());
 }
开发者ID:dharnitski,项目名称:Sitecore.FakeDb,代码行数:5,代码来源:DbItemTest.cs

示例10: NormalizeGuid

 public static string NormalizeGuid(ID id, bool lowercase)
 {
     return lowercase ? id.ToShortID().ToString().ToLowerInvariant() : id.ToShortID().ToString();
 }
开发者ID:csteeg,项目名称:Sitecore-Item-Buckets,代码行数:4,代码来源:IdHelper.cs

示例11: ShouldReturnFieldInfoWithNameFromId

 public void ShouldReturnFieldInfoWithNameFromId(IdBasedFieldGenerator sut, ID id)
 {
   sut.Build(id).Name.Should().Be(id.ToShortID().ToString());
 }
开发者ID:dharnitski,项目名称:Sitecore.FakeDb,代码行数:4,代码来源:IdBasedFieldGeneratorTest.cs


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