本文整理汇总了C#中CallContext类的典型用法代码示例。如果您正苦于以下问题:C# CallContext类的具体用法?C# CallContext怎么用?C# CallContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CallContext类属于命名空间,在下文中一共展示了CallContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetChildIDs
public override Collections.IDList GetChildIDs(Data.ItemDefinition itemDefinition, CallContext context)
{
IDList currentChildIDs = context.CurrentResult as IDList;
IDList idList = new IDList();
XPathNavigator element = (XPathNavigator)courseCache[itemDefinition.ID];// CourseData.SelectSingleNode(string.Format("//course[@id='{0}']", itemDefinition.ID.ToString()));
if (element != null)
{
context.Abort();
XPathNodeIterator childCourses = element.Select("./courses/course");
foreach (XPathNavigator childCourse in childCourses)
{
ID id = ID.Parse(childCourse.GetAttribute("id", string.Empty));
idList.Add(id);
}
}
else if (itemDefinition.ID.ToString() == ParentItemID)
{
context.Abort();
XPathNodeIterator childCourses = CourseData.Select("/courses/course");
foreach (XPathNavigator childCourse in childCourses)
{
ID id = ID.Parse(childCourse.GetAttribute("id", string.Empty));
idList.Add(id);
}
}
return idList;
}
示例2: AddChildIDsForContactFacetItem
protected virtual void AddChildIDsForContactFacetItem(IDList ids, ItemDefinition itemDefinition, CallContext context)
{
var facetName = IDTableHelper.GetFacetName(itemDefinition.ID);
var contractType = ContactFacetHelper.GetContractTypeForFacet(facetName);
foreach (string memberName in FacetReflectionUtil.NonFacetMemberNames(contractType))
{
var id = IDTableHelper.GenerateIdForFacetMember(memberName, itemDefinition.ID,
Sitecore.Strategy.Contacts.DataProviders.TemplateIDs.ContactFacetMemberTemplate);
ids.Add(id);
}
foreach (string memberName in FacetReflectionUtil.FacetMemberNames(contractType))
{
foreach (
string subMemberName in
FacetReflectionUtil.NonFacetMemberNames(contractType.GetProperty(memberName).PropertyType))
{
string key = $"{memberName}{NestedFacets.Delimeter}{subMemberName}";
var id = IDTableHelper.GenerateIdForFacetMember(key, itemDefinition.ID,
Sitecore.Strategy.Contacts.DataProviders.TemplateIDs.ContactFacetMemberTemplate);
ids.Add(id);
}
}
}
示例3: QueryFast
/// <summary>
/// Basically call the standard data provider.
/// Queries the fast.
/// </summary>
/// <param name="query">The query.</param>
/// <param name="context">The context.</param>
/// <returns>A list of IDs.</returns>
protected override IDList QueryFast(string query, CallContext context)
{
var baseIdList = this.SelectIDs(query, context);
if (baseIdList != null && baseIdList.Count > 0) return baseIdList;
if (!this.IsTraceEnabled(query)) return base.QueryFast(query, context);
var parameters = new ParametersList();
var sql = this.Translator.TranslateQuery(query, context, parameters);
Log.Debug(string.Format("FastQuery: {0}", query), this);
Log.Debug(string.Format("SQL Query: {0}", this.FormatSqlQuery(sql, parameters)), this);
if (sql == null) return null;
var stopwatch = Stopwatch.StartNew();
using (var reader = this.Api.CreateReader(sql, parameters.ToArray()))
{
var idList = new IDList();
while (reader.Read())
{
idList.Add(this.Api.GetId(0, reader));
}
context.CurrentResult = idList;
}
Log.Debug(string.Format("Query Time: {0}ms", stopwatch.ElapsedMilliseconds), this);
return null;
}
示例4: GetItemVersions
public override VersionUriList GetItemVersions(ItemDefinition itemDefinition, CallContext context)
{
if (Items.Contains(itemDefinition.ID))
{
Log.Info(string.Format("GetItemVersions called with itemDefinition id = {0}, name = {1} (BasicDataProvider)", itemDefinition.ID, itemDefinition.Name), this);
}
return null;
}
示例5: GetItemDefinition
public override ItemDefinition GetItemDefinition(ID itemId, CallContext context)
{
if (Items.Contains(itemId))
{
Log.Info(string.Format("GetItemDefinition called with itemId = {0} (BasicDataProvider)", itemId), this);
}
return null;
}
示例6: GetItemFields
public override FieldList GetItemFields(ItemDefinition itemDefinition, VersionUri versionUri, CallContext context)
{
if (Items.Contains(itemDefinition.ID))
{
Log.Info(string.Format("GetItemFields called with itemDefinition id = {0}, name = {1}, version = {2}, language = {3} (BasicDataProvider)", itemDefinition.ID, itemDefinition.Name, versionUri.Version, versionUri.Language.Name), this);
}
return null;
}
示例7: GetChildIDs
public override IDList GetChildIDs(ItemDefinition itemDefinition, CallContext context)
{
if (itemDefinition != null && itemDefinition.ID == JoinParentId)
{
Log.Info(string.Format("GetChildIDs called with itemDefinition id = {0}, name = {1} (BasicDataProvider)", itemDefinition.ID, itemDefinition.Name), this);
}
return null;
}
示例8: AddVersion
public void AddVersion(ItemDefinition itemDefinition, VersionUri baseVersion, CallContext context)
{
if (DisableSerialization) return;
Assert.ArgumentNotNull(itemDefinition, "itemDefinition");
SerializeItemIfIncluded(itemDefinition, "Version Added");
}
示例9: Animate
public void Animate(Call call, Response response, CallContext context)
{
JSON js = new JSON();
js.serialized = call.GetParameterString("animation");
lock (queueLock) {
callQueue.Enqueue(new GuideCall(AvatarGuide.State.ANIMATING, (AvatarAnimation)js.ToJSON("avatarAnimation")));
}
}
示例10: SaveItem
public override bool SaveItem(ItemDefinition itemDefinition, ItemChanges changes, CallContext context)
{
if (!base.SaveItem(itemDefinition, changes, context)) return false;
foreach (var provider in _unicornDataProviders)
provider.SaveItem(itemDefinition, changes, context);
return true;
}
示例11: HasChildren
public override bool HasChildren(ItemDefinition itemDefinition, CallContext context)
{
Assert.ArgumentNotNull(itemDefinition, "itemDefinition");
if (!ShouldExecuteProvider(itemDefinition.ID)) return false;
context.Abort();
return GetChildIDs(itemDefinition, context).Count > 0; // we use GetChildIDs here so we can filter on included children
}
示例12: MoveItem
public override bool MoveItem(ItemDefinition itemDefinition, ItemDefinition destination, CallContext context)
{
if (!base.MoveItem(itemDefinition, destination, context)) return false;
foreach (var provider in _unicornDataProviders)
provider.MoveItem(itemDefinition, destination, context);
return true;
}
示例13: AddChildIDsForContactFacetsRootItem
protected virtual void AddChildIDsForContactFacetsRootItem(IDList ids, ItemDefinition itemDefinition, CallContext context)
{
var facetNames = ContactFacetHelper.GetFacetNames();
foreach (var name in facetNames)
{
var id = IDTableHelper.GenerateIdForFacet(name, itemDefinition.ID, Sitecore.Strategy.Contacts.DataProviders.TemplateIDs.ContactFacetTemplate);
ids.Add(id);
}
}
示例14: DataServiceMessageBus
public DataServiceMessageBus(IDependencyResolver resolver, DataServiceConfiguration configuration, CallContext clientContext)
: base(resolver, configuration)
{
config = configuration;
_cntx = clientContext;
var traceManager = resolver.Resolve<ITraceManager>();
_trace = traceManager["SignalR." + typeof(DataServiceMessageBus).Name];
Initialize();
}
示例15: SaveItem
public override bool SaveItem(ItemDefinition itemDefinition, ItemChanges changes, CallContext context)
{
Item item = this.Database.GetItem(itemDefinition.ID);
ItemDefinition parent = GetItemDefinition(item.ParentID, context);
/* only creates the item if it does not exist yet */
CreateItem(itemDefinition.ID, itemDefinition.Name, itemDefinition.TemplateID, parent, context);
bool result = base.SaveItem(itemDefinition, changes, context);
return result;
}