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


C# IRepository.RetrieveNodeset方法代码示例

本文整理汇总了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);
		}
开发者ID:Erikvl87,项目名称:Premotion-Mansion,代码行数:20,代码来源:RetrieveParentNodesetTag.cs

示例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}
                                                       });
        }
开发者ID:Erikvl87,项目名称:Premotion-Mansion,代码行数:21,代码来源:RetrieveBlockNodesetTag.cs

示例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));
        }
开发者ID:Erikvl87,项目名称:Premotion-Mansion,代码行数:29,代码来源:RetrieveThemeNodeTag.cs

示例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}
                                                });
 }
开发者ID:Erikvl87,项目名称:Premotion-Mansion,代码行数:17,代码来源:RepositorySecurityPersistenceService.cs

示例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);
        }
开发者ID:Erikvl87,项目名称:Premotion-Mansion,代码行数:23,代码来源:RepositorySecurityPersistenceService.cs


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