本文整理汇总了C#中IRepository.RetrieveNodeset方法的典型用法代码示例。如果您正苦于以下问题:C# IRepository.RetrieveNodeset方法的具体用法?C# IRepository.RetrieveNodeset怎么用?C# IRepository.RetrieveNodeset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IRepository
的用法示例。
在下文中一共展示了IRepository.RetrieveNodeset方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Retrieve
/// <summary>
/// Builds and executes the query.
/// </summary>
/// <param name="context">The request context.</param>
/// <param name="arguments">The arguments from which to build the query.</param>
/// <param name="repository">The <see cref="IRepository"/>.</param>
/// <param name="parser">The <see cref="IQueryParser"/>.</param>
/// <returns>Returns the <see cref="RecordSet"/>.</returns>
protected override RecordSet Retrieve(IMansionContext context, IPropertyBag arguments, IRepository repository, IQueryParser parser)
{
// parse the query
var query = parser.Parse(context, arguments);
// make sure a parent of clause is specified
if (!query.HasSpecification<ParentOfSpecification>())
throw new InvalidOperationException("The child node was not specified.");
// execute the query
return repository.RetrieveNodeset(context, query);
}
示例2: Retrieve
/// <summary>
/// Builds and executes the query.
/// </summary>
/// <param name="context">The request context.</param>
/// <param name="arguments">The arguments from which to build the query.</param>
/// <param name="repository">The <see cref="IRepository"/>.</param>
/// <param name="parser">The <see cref="IQueryParser"/>.</param>
/// <returns>Returns the <see cref="RecordSet"/>.</returns>
protected override RecordSet Retrieve(IMansionContext context, IPropertyBag arguments, IRepository repository, IQueryParser parser)
{
// get the node
var sourceNode = GetRequiredAttribute<Node>(context, "source");
// retrieve the block nodes
return repository.RetrieveNodeset(context, new PropertyBag
{
{"baseType", "Block"},
{"parentSource", sourceNode},
{"status", NodeStatus.Published}
});
}
示例3: Retrieve
/// <summary>
/// Builds and executes the query.
/// </summary>
/// <param name="context">The request context.</param>
/// <param name="arguments">The arguments from which to build the query.</param>
/// <param name="repository">The <see cref="IRepository"/>.</param>
/// <param name="parser">The <see cref="IQueryParser"/>.</param>
/// <returns>Returns the result.</returns>
protected override Record Retrieve(IMansionContext context, IPropertyBag arguments, IRepository repository, IQueryParser parser)
{
// get the node
var contentNode = GetRequiredAttribute<Node>(context, "source");
// check if this node defines a theme
string theme;
if (contentNode.TryGet(context, "theme", out theme) && !string.IsNullOrEmpty(theme))
return contentNode;
// retrieve the parents of the current node
var parentNodeset = repository.RetrieveNodeset(context, parser.Parse(context, new PropertyBag
{
{"childSource", contentNode},
{"baseType", "Page"},
{"depth", "any"},
{"sort", "depth DESC"}
}));
return parentNodeset.Nodes.FirstOrDefault(parent => parent.TryGet(context, "theme", out theme) && !string.IsNullOrEmpty(theme));
}
示例4: RetrieveUserGroupNodes
/// <summary>
/// Retrieves a <see cref="Nodeset"/> containing the groups to which <paramref name="userNode"/> belongs.
/// </summary>
/// <param name="context"></param>
/// <param name="userNode"></param>
/// <param name="repository"></param>
/// <returns></returns>
private Nodeset RetrieveUserGroupNodes(IMansionContext context, Node userNode, IRepository repository)
{
return repository.RetrieveNodeset(context, new PropertyBag
{
{"baseType", "UserGroup"},
{"userGuids", userNode.Get<string>(context, "guid")},
{"bypassAuthorization", true},
{StorageOnlyQueryComponent.PropertyKey, true}
});
}
示例5: RetrieveRoleNodes
/// <summary>
/// Retrieves a set of roles nodes by <paramref name="roleGuids"/>.
/// </summary>
/// <param name="context"></param>
/// <param name="roleGuids"></param>
/// <param name="repository"></param>
/// <returns></returns>
private Nodeset RetrieveRoleNodes(IMansionContext context, List<string> roleGuids, IRepository repository)
{
var queryProperties = new PropertyBag
{
{"baseType", "Role"},
{"bypassAuthorization", true},
{StorageOnlyQueryComponent.PropertyKey, true}
};
if (roleGuids.Count == 0)
queryProperties.Add("name", "Visitor");
else
queryProperties.Add("guid", string.Join(",", roleGuids));
return repository.RetrieveNodeset(context, queryProperties);
}