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


C# IPropertyBag.Contains方法代码示例

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


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

示例1: DoProcess

		/// <summary>
		/// Processes the <paramref name="parameters"/> and turn them into <paramref name="query"/>.
		/// </summary>
		/// <param name="context">The <see cref="IMansionContext"/>.</param>
		/// <param name="parameters">The parameters which to process.</param>
		/// <param name="query">The <see cref="Query"/> in which to set the parameters.</param>
		protected override void DoProcess(IMansionContext context, IPropertyBag parameters, Query query)
		{
			var clauseCounter = 0;

			// get the depth
			var depthValue = new Lazy<int?>(() =>
			                                {
			                                	int? depth = 1;
			                                	string depthString;
			                                	if (parameters.TryGetAndRemove(context, "depth", out depthString))
			                                	{
			                                		// check for any
			                                		if ("any".Equals(depthString, StringComparison.OrdinalIgnoreCase))
			                                			depth = null;
			                                		else
			                                		{
			                                			// parse the depth
			                                			depth = conversionService.Convert(context, depthString, 1);
			                                		}
			                                	}
			                                	return depth;
			                                });

			// check for parentPointer
			NodePointer parentPointer;
			if (parameters.TryGetAndRemove(context, "childPointer", out parentPointer))
			{
				query.Add(ParentOfSpecification.Child(parentPointer, depthValue.Value));
				clauseCounter++;
			}

			// check for pointer
			Node parentNode;
			if (parameters.TryGetAndRemove(context, "childSource", out parentNode))
			{
				query.Add(ParentOfSpecification.Child(parentNode.Pointer, depthValue.Value));
				clauseCounter++;
			}

			// sort on depth if no explicit sort has been set
			if (clauseCounter > 0 && !parameters.Contains("sort"))
				query.Add(new SortQueryComponent(DefaultSort));

			// check for ambigous parameters
			if (clauseCounter > 1)
				throw new InvalidOperationException("Detected an ambigious parent of clause. Remove either childPointer or childSource.");
		}
开发者ID:Erikvl87,项目名称:Premotion-Mansion,代码行数:53,代码来源:ParentOfQueryArgumentProcessor.cs

示例2: CreateNode

		/// <summary>
		/// Creates a new node in this repository.
		/// </summary>
		/// <param name="context">The <see cref="IMansionContext"/>.</param>
		/// <param name="parent">The parent node.</param>
		/// <param name="newProperties">The properties of the node which to create.</param>
		/// <returns>Returns the created nodes.</returns>
		public Node CreateNode(IMansionContext context, Node parent, IPropertyBag newProperties)
		{
			// validate arguments
			if (context == null)
				throw new ArgumentNullException("context");
			if (parent == null)
				throw new ArgumentNullException("parent");
			if (newProperties == null)
				throw new ArgumentNullException("newProperties");
			CheckDisposed();

			// if no allowedRoleGuids are specified, copy the parens
			if (!newProperties.Contains("allowedRoleGuids"))
				newProperties.Set("allowedRoleGuids", parent.Get(context, "allowedRoleGuids", string.Empty));

			// invoke template method
			return DoCreateNode(context, parent, newProperties);
		}
开发者ID:Erikvl87,项目名称:Premotion-Mansion,代码行数:25,代码来源:RepositoryBase.cs

示例3: Evaluate

		/// <summary>
		/// Check whether a <paramref name="bag"/> contains <paramref name="propertyName"/>.
		/// </summary>
		/// <param name="context">The <see cref="IMansionContext"/>.</param>
		/// <param name="bag">The haystack in which to look.</param>
		/// <param name="propertyName">The name of the property which to check.</param>
		/// <returns>Returns true when <paramref name="bag"/> contains <paramref name="propertyName"/>, otherwise false.</returns>
		public bool Evaluate(IMansionContext context, IPropertyBag bag, string propertyName)
		{
			return bag.Contains(propertyName);
		}
开发者ID:Erikvl87,项目名称:Premotion-Mansion,代码行数:11,代码来源:HasProperty.cs

示例4: DoAfterUpdate

		/// <summary>
		/// Add the job to the scheduler
		/// </summary>
		/// <param name="context"></param>
		/// <param name="record"></param>
		/// <param name="properties"></param>
		protected override void DoAfterUpdate(IMansionContext context, Record record, IPropertyBag properties)
		{
			if (!properties.Contains("_scheduleStatusUpdate"))
				ScheduleJob(context, record as Node);
			base.DoAfterUpdate(context, record, properties);
		}
开发者ID:Erikvl87,项目名称:Premotion-Mansion,代码行数:12,代码来源:JobListener.cs

示例5: DoAuthenticate

 /// <summary>
 /// Authenticates the user.
 /// </summary>
 /// <param name="context">The security context.</param>
 /// <param name="parameters">The parameters used for authentication.</param>
 /// <returns>Returns the <see cref="AuthenticationResult"/>.</returns>
 protected override AuthenticationResult DoAuthenticate(IMansionContext context, IPropertyBag parameters)
 {
     return parameters.Contains("userId") ? AuthenticateWithId(context, parameters) : AuthenticateWithUsernamePassword(context, parameters);
 }
开发者ID:Erikvl87,项目名称:Premotion-Mansion,代码行数:10,代码来源:RepositoryAuthenticationProvider.cs


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