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


C# ASTNode.GetAttribute方法代码示例

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


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

示例1: Translate

		public object Translate(TranslationContext context, ASTNode node)
		{
			var result = new SQLModel.TableExpression();
			var sqlContext = (SQLTranslationContext)context;
			result.TableName = sqlContext.GetExpressionObjectName(String.Format("{0}.{1}", node.GetAttribute<string>("libraryName", sqlContext.ArtifactName), node.GetAttribute<string>("name")));

			// If the expression being referenced is scalar, it will be automatically promoted to a query by the expression def translation
			// In this case, it must be demoted back to a scalar expression with a subquery access.
			if (!(node.ResultType is ListType) && !(node.ResultType is ObjectType))
			{
				var selectExpression = new SQLModel.SelectExpression();
				selectExpression.SelectClause = new SQLModel.SelectClause();
				selectExpression.SelectClause.Columns.Add(new SQLModel.ColumnExpression(new SQLModel.QualifiedFieldExpression("value")));
				selectExpression.FromClause = new SQLModel.CalculusFromClause(new SQLModel.TableSpecifier(result));

				// If the result type is also boolean, the expression will be converted to a 1 or 0, so it must be demoted back to an actual boolean-valued expression
				if (DataTypes.Equal(node.ResultType, DataTypes.Boolean))
				{
					return SQLTranslationUtilities.DemoteBooleanValuedExpression(selectExpression);
				}

				return selectExpression;
			}

			return result;
		}
开发者ID:GuntherM1466,项目名称:healthedecisions,代码行数:26,代码来源:Translators.cs

示例2: Verify

		public void Verify(VerificationContext context, ASTNode node)
		{
			var expressionType = context.ResolveExpressionRef(node.GetAttribute<string>("libraryName"), node.GetAttribute<string>("name"));
			if (expressionType.Expression.ResultType == null)
			{
				throw new InvalidOperationException("Invalid forward reference.");
			}

			node.ResultType = expressionType.Expression.ResultType;
		}
开发者ID:GuntherM1466,项目名称:healthedecisions,代码行数:10,代码来源:Verifiers.cs

示例3: InternalVerify

		protected virtual void InternalVerify(VerificationContext context, ASTNode node, ObjectType dataType)
		{
			// idProperty - If present, must reference a property of type String (or explicitly convertible to string) on the resolved model type.
			var idProperty = node.GetAttribute<string>("idProperty");
			if (!String.IsNullOrEmpty(idProperty))
			{
				var idPropertyType = context.ResolveProperty(dataType, idProperty);
				if (!(DataTypes.Equivalent(idPropertyType, DataTypes.ResolveType(typeof(II))) || DataTypes.Equal(idPropertyType, DataTypes.String)))
				{
					throw new InvalidOperationException("Id property must be either an Identifier or a String.");
				}
			}

			// Validate children
			// timeOffset - If present, must evaluate to a value of type PIVL_TS
			var timeOffset = node.Children.Where(n => n.Name == "timeOffset").FirstOrDefault();
			if (timeOffset != null)
			{
				Verifier.Verify(context, timeOffset);
				context.VerifyType(timeOffset.ResultType, DataTypes.ResolveType(typeof(PIVL_TS)));
			}
		}
开发者ID:GuntherM1466,项目名称:healthedecisions,代码行数:22,代码来源:Verifiers.cs

示例4: Translate

        public object Translate(TranslationContext context, ASTNode node)
        {
            var scope = node.GetAttribute<string>("scope", VerificationContext.Current);
            if (scope != VerificationContext.Current)
            {
                throw new NotSupportedException("Translation of filter expression is not supported because it involves a named scope reference, which is not supported in CREF.");
            }

            var source = node.Children[0];
            var condition = node.Children[1];

            var result = new CREFModel.FilterExpression();
            result.Items.Add(context.TranslateNode(source));
            result.Items.Add(context.TranslateNode(condition));

            return result;
        }
开发者ID:suesse,项目名称:healthedecisions,代码行数:17,代码来源:Translators.cs


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