本文整理汇总了C#中Remotion.Linq.Parsing.Structure.IntermediateModel.MethodCallExpressionParseInfo类的典型用法代码示例。如果您正苦于以下问题:C# MethodCallExpressionParseInfo类的具体用法?C# MethodCallExpressionParseInfo怎么用?C# MethodCallExpressionParseInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MethodCallExpressionParseInfo类属于Remotion.Linq.Parsing.Structure.IntermediateModel命名空间,在下文中一共展示了MethodCallExpressionParseInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FetchExpressionNodeBase
public FetchExpressionNodeBase (MethodCallExpressionParseInfo parseInfo, LambdaExpression relatedObjectSelector)
: base (parseInfo, null, null)
{
ArgumentUtility.CheckNotNull ("relatedObjectSelector", relatedObjectSelector);
var memberExpression = relatedObjectSelector.Body as MemberExpression;
if (memberExpression == null)
{
var message = string.Format (
"A fetch request must be a simple member access expression; '{0}' is a {1} instead.",
relatedObjectSelector.Body,
relatedObjectSelector.Body.GetType ().Name);
throw new ArgumentException (message, "relatedObjectSelector");
}
if (memberExpression.Expression.NodeType != ExpressionType.Parameter)
{
var message = string.Format (
"A fetch request must be a simple member access expression of the kind o => o.Related; '{0}' is too complex.",
relatedObjectSelector.Body);
throw new ArgumentException (message, "relatedObjectSelector");
}
RelationMember = memberExpression.Member;
}
示例2: GroupJoinExpressionNode
public GroupJoinExpressionNode (
MethodCallExpressionParseInfo parseInfo,
Expression innerSequence,
LambdaExpression outerKeySelector,
LambdaExpression innerKeySelector,
LambdaExpression resultSelector)
: base(parseInfo)
{
ArgumentUtility.CheckNotNull ("innerSequence", innerSequence);
ArgumentUtility.CheckNotNull ("outerKeySelector", outerKeySelector);
ArgumentUtility.CheckNotNull ("innerKeySelector", innerKeySelector);
ArgumentUtility.CheckNotNull ("resultSelector", resultSelector);
if (outerKeySelector.Parameters.Count != 1)
throw new ArgumentException ("Outer key selector must have exactly one parameter.", "outerKeySelector");
if (innerKeySelector.Parameters.Count != 1)
throw new ArgumentException ("Inner key selector must have exactly one parameter.", "innerKeySelector");
if (resultSelector.Parameters.Count != 2)
throw new ArgumentException ("Result selector must have exactly two parameters.", "resultSelector");
var joinResultSelector = Expression.Lambda (Expression.Constant (null), outerKeySelector.Parameters[0], innerKeySelector.Parameters[0]);
JoinExpressionNode = new JoinExpressionNode (parseInfo, innerSequence, outerKeySelector, innerKeySelector, joinResultSelector);
ResultSelector = resultSelector;
_cachedResultSelector = new ResolvedExpressionCache<Expression> (this);
}
示例3: QueryAnnotationExpressionNode
public QueryAnnotationExpressionNode(
MethodCallExpressionParseInfo parseInfo,
[NotNull] ConstantExpression annotationExpression)
: base(parseInfo, null, null)
{
_annotationExpression = annotationExpression;
}
示例4: JoinExpressionNode
public JoinExpressionNode(
MethodCallExpressionParseInfo parseInfo,
Expression innerSequence,
LambdaExpression outerKeySelector,
LambdaExpression innerKeySelector,
LambdaExpression resultSelector)
: base(parseInfo)
{
ArgumentUtility.CheckNotNull ("innerSequence", innerSequence);
ArgumentUtility.CheckNotNull ("outerKeySelector", outerKeySelector);
ArgumentUtility.CheckNotNull ("innerKeySelector", innerKeySelector);
ArgumentUtility.CheckNotNull ("resultSelector", resultSelector);
if (outerKeySelector.Parameters.Count != 1)
throw new ArgumentException ("Outer key selector must have exactly one parameter.", "outerKeySelector");
if (innerKeySelector.Parameters.Count != 1)
throw new ArgumentException ("Inner key selector must have exactly one parameter.", "innerKeySelector");
if (resultSelector.Parameters.Count != 2)
throw new ArgumentException ("Result selector must have exactly two parameters.", "resultSelector");
InnerSequence = innerSequence;
OuterKeySelector = outerKeySelector;
InnerKeySelector = innerKeySelector;
ResultSelector = resultSelector;
_cachedOuterKeySelector = new ResolvedExpressionCache<Expression> (this);
_cachedInnerKeySelector = new ResolvedExpressionCache<Expression> (this);
_cachedResultSelector = new ResolvedExpressionCache<Expression> (this);
}
示例5: CreateExpressionNode
/// <summary>
/// Creates an instace of type <paramref name="nodeType"/>.
/// </summary>
/// <exception cref="ExpressionNodeInstantiationException">
/// Thrown if the <paramref name="parseInfo"/> or the <paramref name="additionalConstructorParameters"/>
/// do not match expected constructor parameters of the <paramref name="nodeType"/>.
/// </exception>
public static IExpressionNode CreateExpressionNode(
Type nodeType, MethodCallExpressionParseInfo parseInfo, object[] additionalConstructorParameters)
{
ArgumentUtility.CheckNotNull ("nodeType", nodeType);
ArgumentUtility.CheckTypeIsAssignableFrom ("nodeType", nodeType, typeof (IExpressionNode));
ArgumentUtility.CheckNotNull ("additionalConstructorParameters", additionalConstructorParameters);
#if NETFX_CORE
var constructors = nodeType.GetTypeInfo().DeclaredConstructors.Where (c => c.IsPublic).ToArray();
#else
var constructors = nodeType.GetTypeInfo().GetConstructors().Where (c => c.IsPublic).ToArray();
#endif
if (constructors.Length > 1)
{
var message = string.Format (
"Expression node type '{0}' contains too many constructors. It must only contain a single constructor, allowing null to be passed for any optional arguments.",
nodeType.FullName);
throw new ArgumentException (message, "nodeType");
}
object[] constructorParameterArray = GetParameterArray (constructors[0], parseInfo, additionalConstructorParameters);
try
{
return (IExpressionNode) constructors[0].Invoke (constructorParameterArray);
}
catch (ArgumentException ex)
{
var message = GetArgumentMismatchMessage (ex);
throw new ExpressionNodeInstantiationException (message);
}
}
示例6: QuerySourceSetOperationExpressionNodeBase
protected QuerySourceSetOperationExpressionNodeBase (MethodCallExpressionParseInfo parseInfo, Expression source2)
: base (parseInfo, null, null)
{
ArgumentUtility.CheckNotNull ("source2", source2);
_source2 = source2;
_itemType = ReflectionUtility.GetItemTypeOfClosedGenericIEnumerable (parseInfo.ParsedExpression.Type, "expression");
}
示例7: UnionExpressionNode
public UnionExpressionNode (MethodCallExpressionParseInfo parseInfo, Expression source2)
: base (parseInfo, null, null)
{
ArgumentUtility.CheckNotNull ("source2", source2);
Source2 = source2;
ItemType = ReflectionUtility.GetItemTypeOfClosedGenericIEnumerable (parseInfo.ParsedExpression.Type, "expression");
}
示例8: SetUp
public override void SetUp ()
{
base.SetUp();
_keySelector = ExpressionHelper.CreateLambdaExpression<int, short> (i => (short) i);
_elementSelector = ExpressionHelper.CreateLambdaExpression<int, string> (i => i.ToString());
_resultSelectorWithElementSelector =
ExpressionHelper.CreateLambdaExpression<short, IEnumerable<string>, Tuple<short, int>> ((key, group) => Tuple.Create (key, group.Count()));
_sourceEnumerable = ExpressionHelper.CreateIntQueryable();
var methodCallExpressionWithElementSelector = (MethodCallExpression) ExpressionHelper.MakeExpression (
() => _sourceEnumerable.GroupBy (
i => (short) i,
i => i.ToString(),
(key, group) => Tuple.Create (key, group.Count())));
_parseInfoWithElementSelector = new MethodCallExpressionParseInfo ("g", SourceNode, methodCallExpressionWithElementSelector);
_nodeWithElementSelector = new GroupByWithResultSelectorExpressionNode (
_parseInfoWithElementSelector,
_keySelector,
_elementSelector,
_resultSelectorWithElementSelector);
var methodCallExpressionWithoutElementSelector = (MethodCallExpression) ExpressionHelper.MakeExpression (
() => _sourceEnumerable.GroupBy (
i => (short) i,
(key, group) => Tuple.Create (key, group.Count())));
_resultSelectorWithoutElementSelector =
ExpressionHelper.CreateLambdaExpression<short, IEnumerable<int>, Tuple<short, int>> ((key, group) => Tuple.Create (key, group.Count()));
_nodeWithoutElementSelector = new GroupByWithResultSelectorExpressionNode (
new MethodCallExpressionParseInfo ("g", SourceNode, methodCallExpressionWithoutElementSelector),
_keySelector,
_resultSelectorWithoutElementSelector,
null);
}
示例9: ThenIncludeExpressionNode
public ThenIncludeExpressionNode(
MethodCallExpressionParseInfo parseInfo,
[NotNull] LambdaExpression navigationPropertyPathLambda)
: base(parseInfo, null, null)
{
_navigationPropertyPathLambda = navigationPropertyPathLambda;
}
示例10: SelectManyExpressionNode
public SelectManyExpressionNode (
MethodCallExpressionParseInfo parseInfo, LambdaExpression collectionSelector, LambdaExpression resultSelector)
: base (parseInfo)
{
ArgumentUtility.CheckNotNull ("collectionSelector", collectionSelector);
if (collectionSelector.Parameters.Count != 1)
throw new ArgumentException ("Collection selector must have exactly one parameter.", "collectionSelector");
CollectionSelector = collectionSelector;
if (resultSelector != null)
{
if (resultSelector.Parameters.Count != 2)
throw new ArgumentException ("Result selector must have exactly two parameters.", "resultSelector");
ResultSelector = resultSelector;
}
else
{
var parameter1 = Expression.Parameter (collectionSelector.Parameters[0].Type, collectionSelector.Parameters[0].Name);
var itemType = ReflectionUtility.GetItemTypeOfClosedGenericIEnumerable (CollectionSelector.Body.Type, "collectionSelector");
var parameter2 = Expression.Parameter (itemType, parseInfo.AssociatedIdentifier);
ResultSelector = Expression.Lambda (parameter2, parameter1, parameter2);
}
_cachedCollectionSelector = new ResolvedExpressionCache<Expression> (this);
_cachedResultSelector = new ResolvedExpressionCache<Expression> (this);
}
示例11: AllExpressionNode
public AllExpressionNode (MethodCallExpressionParseInfo parseInfo, LambdaExpression predicate)
: base (parseInfo, null, null)
{
ArgumentUtility.CheckNotNull ("predicate", predicate);
_predicate = predicate;
_cachedPredicate = new ResolvedExpressionCache<Expression> (this);
}
示例12: IncludeExpressionNode
public IncludeExpressionNode(
MethodCallExpressionParseInfo parseInfo,
[NotNull] LambdaExpression navigationPropertyPathLambda)
: base(parseInfo, null, null)
{
Check.NotNull(navigationPropertyPathLambda, nameof(navigationPropertyPathLambda));
_navigationPropertyPathLambda = navigationPropertyPathLambda;
}
示例13: FromSqlExpressionNode
public FromSqlExpressionNode(
MethodCallExpressionParseInfo parseInfo,
[NotNull] ConstantExpression sql,
[NotNull] Expression arguments)
: base(parseInfo, null, null)
{
_sql = (string)sql.Value;
_arguments = arguments;
}
示例14: WhereMissingExpressionNode
public WhereMissingExpressionNode(MethodCallExpressionParseInfo parseInfo, LambdaExpression predicate)
: base(parseInfo)
{
if (predicate.Parameters.Count != 1)
throw new ArgumentException("Predicate must have exactly one parameter.", "predicate");
Predicate = predicate;
_cachedPredicate = new ResolvedExpressionCache<Expression>(this);
}
示例15: MethodCallExpressionNodeBase
protected MethodCallExpressionNodeBase (MethodCallExpressionParseInfo parseInfo)
{
if (parseInfo.AssociatedIdentifier == null)
throw new ArgumentException ("Unitialized struct.", "parseInfo");
_associatedIdentifier = parseInfo.AssociatedIdentifier;
_source = parseInfo.Source;
_nodeResultType = parseInfo.ParsedExpression.Type;
}