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


C# IPropertyBag.TrySet方法代码示例

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


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

示例1: DoBeforeCreate

        /// <summary>
        /// This method is called just before a node is created by the repository.
        /// </summary>
        /// <param name="context">The <see cref="IMansionContext"/>.</param>
        /// <param name="properties">The new properties of the node.</param>
        protected override void DoBeforeCreate(IMansionContext context, IPropertyBag properties)
        {
            // check if the layout is set
            string layout;
            if (properties.TryGet(context, "layout", out layout))
                return;

            // set the layout
            properties.TrySet("layout", layout);
        }
开发者ID:Erikvl87,项目名称:Premotion-Mansion,代码行数:15,代码来源:PageLayoutChangeListener.cs

示例2: DoBeforeCreate

        /// <summary>
        /// This method is called just before a node is created by the repository.
        /// </summary>
        /// <param name="context">The <see cref="IMansionContext"/>.</param>
        /// <param name="parent">The parent node to which the new child will be added.</param>
        /// <param name="newProperties">The new properties of the node.</param>
        protected override void DoBeforeCreate(IMansionContext context, Node parent, IPropertyBag newProperties)
        {
            // check if the layout is set
            string layout;
            if (newProperties.TryGet(context, "layout", out layout))
                return;
            if (!parent.TryGet(context, "layout", out layout))
                layout = "OneColumnLayout";

            // set the layout
            newProperties.TrySet("layout", layout);
        }
开发者ID:Erikvl87,项目名称:Premotion-Mansion,代码行数:18,代码来源:PageLayoutChangeListener.cs

示例3: Prepare

		/// <summary>
		/// Prepares an insert query.
		/// </summary>
		/// <param name="context"></param>
		/// <param name="connection">The connection.</param>
		/// <param name="transaction">The transaction.</param>
		/// <param name="node"></param>
		/// <param name="modifiedProperties"></param>
		/// <returns></returns>
		public void Prepare(IMansionContext context, SqlConnection connection, SqlTransaction transaction, Node node, IPropertyBag modifiedProperties)
		{
			// validate arguments
			if (connection == null)
				throw new ArgumentNullException("connection");
			if (transaction == null)
				throw new ArgumentNullException("transaction");
			if (node == null)
				throw new ArgumentNullException("node");
			if (modifiedProperties == null)
				throw new ArgumentNullException("modifiedProperties");

			// set the modified date
			modifiedProperties.TrySet("modified", DateTime.Now);

			// retrieve the type
			var type = typeService.Load(context, node.Pointer.Type);

			// retrieve the schema
			var schema = Resolver.Resolve(context, type);

			// set the full text property
			SqlServerUtilities.PopulateFullTextColumn(context, type, modifiedProperties, node);

			// create the commandse
			command = connection.CreateCommand();
			command.CommandType = CommandType.Text;
			command.Transaction = transaction;

			// prepare the query
			var queryBuilder = new ModificationQueryBuilder(command);

			// loop through all the tables in the schema and let them prepare for update
			foreach (var table in schema.Tables)
				table.ToUpdateStatement(context, queryBuilder, node, modifiedProperties);

			// finish the insert statement
			command.CommandText = queryBuilder.ToStatement();
		}
开发者ID:Erikvl87,项目名称:Premotion-Mansion,代码行数:48,代码来源:UpdateNodeCommand.cs


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