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


C# ID.ToGuid方法代码示例

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


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

示例1: GetControllerType

		public static ControllerType GetControllerType(ID parentId, ID id)
		{
			ControllerType type;
			if (GetControllerIds(parentId.ToGuid()).TryGetValue(id.ToGuid(), out type))
				return type;
			return null;
		}
开发者ID:bplasmeijer,项目名称:BoC.Sitecore.MVC,代码行数:7,代码来源:ControllerType.cs

示例2: CreateRedirect

        public virtual void CreateRedirect(string site, string oldPath, ID itemId, string queryString)
        {
            DeleteRedirect(site, oldPath);

            using (RedirectorDbContext db = new RedirectorDbContext())
            {
                var redirect = new RedirectEntry()
                {
                    RedirectEntryId = Guid.NewGuid(),
                    Site = site,
                    OldPath = oldPath,
                    ItemID = itemId.ToGuid(),
                    QueryString = queryString
                };

                db.RedirectEntries.Add(redirect);

                db.SaveChanges();
            }
        }
开发者ID:NTTDATA,项目名称:Redirector,代码行数:20,代码来源:RedirectProvider.cs

示例3: Create

        internal Infrastructure.Data.Form Create(ID formId, AdaptedResultList fields, ID sessionID, string data)
        {
            Assert.ArgumentNotNull(formId, "formId");
              Assert.ArgumentNotNull(fields, "fields");

              Infrastructure.Data.Form form = new Infrastructure.Data.Form
              {
            Id = Guid.NewGuid(),
            FormItemId = formId.Guid,
            SessionId = sessionID.ToGuid(),
            Data = data,
            StorageName = string.Empty,
            Timestamp = DateTime.Now
              };

              foreach (AdaptedControlResult adaptedControlResult in fields)
              {
            Infrastructure.Data.Field field = _fieldFactory.Create(adaptedControlResult);
            form.Fields.Add(field);
              }

              return form;
        }
开发者ID:ptiemann,项目名称:WFFM-SQL-Server-SaveToDatabase,代码行数:23,代码来源:FormFactory.cs

示例4: GetPrefetchData

        private PrefetchData GetPrefetchData(ID itemId)
        {
            PrefetchData data = this.PrefetchCache[itemId] as PrefetchData;
            if (data != null)
            {
                if (!data.ItemDefinition.IsEmpty)
                {
                    return data;
                }
                return null;
            }
            ItemInfo result = Items.FindOneByIdAs<ItemInfo>(itemId.ToGuid());

            if (result != null)
            {
                data = new PrefetchData(new ItemDefinition(itemId, result.Name, new ID(result.TemplateID), new ID(result.BranchID)), new ID(result.ParentID));
                this.PrefetchCache.Add(itemId, data, data.GetDataLength());
                return data;
            }

            return null;
        }
开发者ID:hermanussen,项目名称:MongoDataProvider,代码行数:22,代码来源:MongoDataProvider.cs

示例5: CreateItem

        /// <summary>
        /// Create a new item as a child of another item.
        /// Note that this does not create any versions or field values.
        /// </summary>
        /// <param name="itemID">The item ID (not the parent's)</param>
        /// <param name="itemName">The name of the new item</param>
        /// <param name="templateID">The ID of the content item that represents its template</param>
        /// <param name="parent">The parent item's definition</param>
        /// <param name="context"></param>
        /// <returns></returns>
        public override bool CreateItem(ID itemID, string itemName, ID templateID, ItemDefinition parent, CallContext context)
        {
            ItemBase current = Items.FindOneByIdAs<ItemBase>(itemID.ToGuid());
            if (current != null)
            {
                // item already exists
                return false;
            }

            if (parent != null)
            {
                ItemBase parentItem = Items.FindOneByIdAs<ItemBase>(parent.ID.ToGuid());
                if (parentItem == null)
                {
                    // parent item does not exist in this provider
                    return false;
                }
            }

            Items.Save(new ItemInfo()
                {
                    _id = itemID.ToGuid(),
                    Name = itemName,
                    TemplateID = templateID.ToGuid(),
                    ParentID = parent != null ? parent.ID.ToGuid() : Guid.Empty
                }, SafeMode);

            return true;
        }
开发者ID:hermanussen,项目名称:MongoDataProvider,代码行数:39,代码来源:MongoDataProvider.cs

示例6: GetPrefetchData

        private PrefetchData GetPrefetchData(ID itemId)
        {
            var data = PrefetchCache[itemId] as PrefetchData;

            if (data != null)
            {
                if (!data.ItemDefinition.IsEmpty)
                {
                    return data;
                }

                return null;
            }

            var itemDto = Provider.GetItem(itemId.ToGuid());

            if (itemDto != null)
            {
                data = new PrefetchData(new ItemDefinition(itemId, itemDto.Name, new ID(itemDto.TemplateId), new ID(itemDto.BranchId)), new ID(itemDto.ParentId));

                PrefetchCache.Add(itemId, data, data.GetDataLength());

                return data;
            }

            return null;
        }
开发者ID:jerrong,项目名称:SitecoreData,代码行数:27,代码来源:DataProviderWrapper.cs

示例7: CreateItem

        public override bool CreateItem(ID itemId, string itemName, ID templateId, ItemDefinition parent, CallContext context)
        {
            var current = Provider.GetItem(itemId.ToGuid());

            if (current != null)
            {
                return false;
            }

            if (parent != null)
            {
                var parentItem = Provider.GetItem(parent.ID.ToGuid());

                if (parentItem == null)
                {
                    return false;
                }
            }

            var provider = Provider.WritableProvider;

            Guid parentId;

            if (parent == null)
            {
                parentId = Guid.Empty;
            }
            else
            {
                parentId = parent.ID.ToGuid();
            }

            provider.CreateItem(itemId.ToGuid(), itemName, templateId.ToGuid(), parentId);

            return true;
        }
开发者ID:jerrong,项目名称:SitecoreData,代码行数:36,代码来源:DataProviderWrapper.cs

示例8: GetAverageDailyVisits

 public double GetAverageDailyVisits(ID itemId, DateTime startDate, DateTime endDate)
 {
     VisitStatistics statistics = DataAdapterManager.Testing.GetPageStatistics(itemId.ToGuid(), startDate, endDate);
     if (statistics.NumberOfVisits <= 0L)
     {
         return 0.0;
     }
     TimeSpan span = (statistics.DateOfLastVisit - statistics.DateOfFirstVisit);
     int days = span.Duration().Days;
     if (days == 0)
     {
         days = 1;
     }
     return ((statistics.NumberOfVisits) / ((double)days));
 }
开发者ID:Velir,项目名称:Sitecore-Analytics,代码行数:15,代码来源:PageStatisticsContext.cs

示例9: GetControllerType

 public static ControllerType GetControllerType(ID id)
 {
     ControllerType controller = null;
     GetAllControllers().TryGetValue(id.ToGuid(), out controller);
     return controller;
 }
开发者ID:wavveen,项目名称:BoC.Sitecore.CodefirstRenderings,代码行数:6,代码来源:ControllerType.cs

示例10: GetItemDefinition

        public override ItemDefinition GetItemDefinition(ID itemId, CallContext context)
        {
            Assert.ArgumentNotNull(itemId, "itemId");
            Assert.ArgumentNotNull(context, "context");
            if (GetSqlVersion(itemId, context, GetSqlProvider(Database)) != null)
                return null;
            
            if (itemId == FolderId)
                return new ItemDefinition(itemId, FolderName, FolderTemplateId, this.MasterId);
            

            var allNamespaces = ControllerType.GetAllNamespaces();
            var nspace = allNamespaces.ContainsKey(itemId.ToGuid()) ? allNamespaces[itemId.ToGuid()] : null;
            if (!string.IsNullOrEmpty(nspace))
            {
                return new ItemDefinition(itemId, nspace, FolderTemplateId, this.MasterId);
            }

            var type = ControllerType.GetControllerType(itemId);
            if (type != null)
            {
                return new ItemDefinition(itemId, type.ControllerName, FolderTemplateId, this.MasterId);
            }

            var action = ControllerAction.GetControllerAction(itemId);
            if (action != null)
            {
                return new ItemDefinition(itemId, action.ActionName, ControllerRenderingId, this.MasterId);
            }

            return base.GetItemDefinition(itemId, context);
        }
开发者ID:wavveen,项目名称:BoC.Sitecore.CodefirstRenderings,代码行数:32,代码来源:CodeFirstRenderingsDataProvider.cs

示例11: GetRedirects

 public virtual IEnumerable<RedirectEntry> GetRedirects(ID itemId)
 {
     using (RedirectorDbContext db = new RedirectorDbContext())
     {
         return db.RedirectEntries.Where(r => r.ItemID == itemId.ToGuid()).OrderBy(r => r.ItemID);
     }
 }
开发者ID:NTTDATA,项目名称:Redirector,代码行数:7,代码来源:RedirectProvider.cs


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