本文整理汇总了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;
}
示例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();
}
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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));
}
示例9: GetControllerType
public static ControllerType GetControllerType(ID id)
{
ControllerType controller = null;
GetAllControllers().TryGetValue(id.ToGuid(), out controller);
return controller;
}
示例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);
}
示例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);
}
}