本文整理汇总了C#中Expression.Calculate方法的典型用法代码示例。如果您正苦于以下问题:C# Expression.Calculate方法的具体用法?C# Expression.Calculate怎么用?C# Expression.Calculate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Expression
的用法示例。
在下文中一共展示了Expression.Calculate方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WriteComment
public MDXValue WriteComment(Expression expressionToEvaluate
,Tuple tupleToEvaluate
, int eventSubClass
, int numberData
, string textData)
{
Context.TraceEvent(eventSubClass, numberData, textData);
MDXValue m = expressionToEvaluate.Calculate(tupleToEvaluate);
return m ;
}
开发者ID:sergey-vdovin,项目名称:Slicing-and-dicing-over-data-differences-between-SSAS-databases,代码行数:10,代码来源:WriteToProfiler.cs
示例2: scriptComment
private static string scriptComment()
{
string comment;
comment = System.Environment.NewLine;
comment += "--Assignment Made By Stored Procedure ";
comment += System.Environment.NewLine;
comment += "--Date: " + DateTime.Now.Date.ToString("F");
comment += System.Environment.NewLine;
Expression e = new Expression("UserName");
comment += "--User: " + e.Calculate(null).ToString();
comment += System.Environment.NewLine;
return comment;
}
开发者ID:sergey-vdovin,项目名称:Slicing-and-dicing-over-data-differences-between-SSAS-databases,代码行数:13,代码来源:WritebackWithAssignments.cs
示例3: RegExFilter
public static Set RegExFilter(Set setToFilter, String pattern, Expression exp, Boolean caseSensitive)
{
Context.TraceEvent(100, 0, "RegExFilter: Starting");
// If there is no startsWith string, just return the whole set
if (pattern.Length == 0)
{
Context.TraceEvent(100, 0, "RegExFilter: Finished (No pattern parameter)");
return setToFilter;
}
if (setToFilter == null)
{
throw new ArgumentNullException("setToFilter");
}
else
{
using(SetBuilder sb = new SetBuilder())
{
RegexOptions optRegex = RegexOptions.Compiled;
if (!caseSensitive)
{
optRegex = optRegex | RegexOptions.IgnoreCase;
}
Regex r = getCachedRegEx(pattern, optRegex);
foreach (Tuple t in setToFilter.Tuples)
{
string val = (string)exp.Calculate(t);
if (r.Match(val).Success)
{
sb.Add(t);
}
}
Context.TraceEvent(100, sb.Count, "RegExFilter: Finished (returning " + sb.Count.ToString() + " tuples");
return sb.ToSet();
}
}
}
开发者ID:sergey-vdovin,项目名称:Slicing-and-dicing-over-data-differences-between-SSAS-databases,代码行数:39,代码来源:StringFilters.cs
示例4: ValueAtPercentile
public static double ValueAtPercentile(Set inputSet, Expression sortExpression, double percentileValue, bool sortAscending, string calcMethod)
{
//get position where percentile falls
double Rank = RangePoint(inputSet, percentileValue, calcMethod);
double RankFloorValue = 0;
double RankCeilingValue = 0;
//order the set ascending using Codeplex SSAS Stored Procedure Function
if (sortAscending)
{
Set s = SetOperations.Order(inputSet, sortExpression);
int i = 0;
foreach(Tuple t in s)
{
if(i == System.Math.Floor(Rank))
{
RankFloorValue = sortExpression.Calculate(t).ToDouble();
}
else if (i == System.Math.Ceiling(Rank))
{
RankCeilingValue = sortExpression.Calculate(t).ToDouble();
break;
}
i++;
}
//if the Rank is a whole number
if ((Rank % 1) == 0)
{
return RankFloorValue;
}
//if Rank is a decimal
else
{
return
(RankFloorValue
+
(Rank % 1 *
(RankCeilingValue
- RankFloorValue
)));
/*(((sortExpression.Calculate(s.Tuples[Convert.ToInt32(Rank) + 1]).ToDouble()
- sortExpression.Calculate(s.Tuples[Convert.ToInt32(Rank)]).ToDouble())) * (Rank - Convert.ToInt32(Rank)));*/
}
}
else {
int i = 0;
foreach (Tuple t in inputSet)
{
if (i == System.Math.Floor(Rank))
{
RankFloorValue = sortExpression.Calculate(t).ToDouble();
}
else if (i == System.Math.Ceiling(Rank))
{
RankCeilingValue = sortExpression.Calculate(t).ToDouble();
break;
}
i++;
}
//if the Rank is a whole number
if ((Rank % 1) == 0)
{
return RankFloorValue;;
}
//if Rank is a decimal
else
{
return
(RankFloorValue
+
(Rank % 1 *
(RankCeilingValue
- RankFloorValue
)));
}
}
}
开发者ID:sergey-vdovin,项目名称:Slicing-and-dicing-over-data-differences-between-SSAS-databases,代码行数:79,代码来源:Percentiles.cs