Remotion.Linq Indicates the condition parameter of the assertion method. The method itself should be marked by attribute. The mandatory argument of the attribute is the assertion type. Initializes new instance of AssertionConditionAttribute Specifies condition type Gets condition type Specifies assertion type. If the assertion method argument satisifes the condition, then the execution continues. Otherwise, execution is assumed to be halted Indicates that the marked parameter should be evaluated to true Indicates that the marked parameter should be evaluated to false Indicates that the marked parameter should be evaluated to null value Indicates that the marked parameter should be evaluated to not null value Indicates that the marked method is assertion method, i.e. it halts control flow if one of the conditions is satisfied. To set the condition, mark one of the parameters with attribute When applied to target attribute, specifies a requirement for any type which is marked with target attribute to implement or inherit specific type or types [BaseTypeRequired(typeof(IComponent)] // Specify requirement public class ComponentAttribute : Attribute {} [Component] // ComponentAttribute requires implementing IComponent interface public class MyComponent : IComponent {} Initializes new instance of BaseTypeRequiredAttribute Specifies which types are required Gets enumerations of specified base types Indicates that the value of marked element could be null sometimes, so the check for null is necessary before its usage Indicates that the value of marked type (or its derivatives) cannot be compared using '==' or '!=' operators. There is only exception to compare with null, it is permitted Describes dependency between method input and output

Function definition table syntax:

FDT ::= FDTRow [;FDTRow]* FDTRow ::= Input => Output | Output <= Input Input ::= ParameterName: Value [, Input]* Output ::= [ParameterName: Value]* {halt|stop|void|nothing|Value} Value ::= true | false | null | notnull | canbenull If method has single input parameter, it's name could be omitted.
Using "halt" (or "void"/"nothing", which is the same) for method output means that methos doesn't return normally.
"canbenull" annotation is only applicable for output parameters.
You can use multiple [ContractAnnotation] for each FDT row, or use single attribute with rows separated by semicolon.
[ContractAnnotation("=> halt")] public void TerminationMethod() [ContractAnnotation("halt <= condition: false")] public void Assert(bool condition, string text) // Regular Assertion method [ContractAnnotation("s:null => true")] public bool IsNullOrEmpty(string s) // String.IsNullOrEmpty [ContractAnnotation("null => null; notnull => notnull")] public object Transform(object data) // Method which returns null if parameter is null, and not null if parameter is not null [ContractAnnotation("s:null=>false; =>true,result:notnull; =>false, result:null")] public bool TryParse(string s, out Person result)
Only entity marked with attribute considered used Indicates implicit assignment to a member Indicates implicit instantiation of a type with fixed constructor signature. That means any unused constructor parameters won't be reported as such. Indicates implicit instantiation of a type Specify what is considered used implicitly when marked with or Members of entity marked with attribute are considered used Entity marked with attribute and all its members considered used Tells code analysis engine if the parameter is completely handled when the invoked method is on stack. If the parameter is delegate, indicates that delegate is executed while the method is executed. If the parameter is enumerable, indicates that it is enumerated while the method is executed. Indicates that the function argument should be string literal and match one of the parameters of the caller function. For example, has such parameter. Indicates that method is *pure* linq method, with postponed enumeration. C# iterator methods (yield ...) are always LinqTunnel. Indicates that marked element should be localized or not. Initializes a new instance of the class with set to . Initializes a new instance of the class. true if a element should be localized; otherwise, false. Returns whether the value of the given object is equal to the current . The object to test the value equality of. true if the value of the given object is equal to that of the current; otherwise, false. Returns the hash code for this instance. A hash code for the current . Gets a value indicating whether a element should be localized. true if a element should be localized; otherwise, false. Should be used on attributes and causes ReSharper to not mark symbols marked with such attributes as unused (as well as by other usage inspections) Gets value indicating what is meant to be used Indicates that IEnumarable, passed as parameter, is not enumerated. Indicates that the function is used to notify class type property value is changed. Indicates that the value of marked element could never be null This attribute is intended to mark publicly available API which should not be removed and so is treated as used. Indicates that method doesn't contain observable side effects. Indicates that marked method builds string by format pattern and (optional) arguments. Parameter, which contains format string, should be given in constructor. The format string should be in -like form Initializes new instance of StringFormatMethodAttribute Specifies which parameter of an annotated method should be treated as format-string Gets format parameter name Indicates that the marked method unconditionally terminates control flow execution. For example, it could unconditionally throw exception Indicates that the marked symbol is used implicitly (e.g. via reflection, in external library), so this symbol will not be marked as unused (as well as by other usage inspections) Gets value indicating what is meant to be used This utility class provides methods for checking arguments. Some methods of this class return the value of the parameter. In some cases, this is useful because the value will be converted to another type: ("o", o); } ]]> In some other cases, the input value is returned unmodified. This makes it easier to use the argument checks in calls to base class constructors or property setters: Returns the value itself if it is not and of the specified value type. The type that must have. The is a . The is an instance of another type. Checks of the is of the . The is a . The is an instance of another type. Returns the value itself if it is of the specified type. The type that must have. is an instance of another type (which is not a subtype of ). is null and cannot be null. For non-nullable value types, you should use either or pass the type instead. Checks whether is not and can be assigned to . The is . The cannot be assigned to . Checks whether can be assigned to . The cannot be assigned to . Checks whether can be assigned to . The cannot be assigned to . Checks whether all items in are of type or a null reference. If at least one element is not of the specified type or a derived type. Checks whether all items in are of type and not null references. If at least one element is not of the specified type or a derived type. If at least one element is a null reference. Provides methods that throw an if an assertion fails. This class contains methods that are conditional to the DEBUG and TRACE attributes ( and ). Note that assertion expressions passed to these methods are not evaluated (read: executed) if the respective symbol are not defined during compilation, nor are the methods called. This increases performance for production builds, but make sure that your assertion expressions do not cause any side effects! See or and the for more information about conditional compilation. Assertions are no replacement for checking input parameters of public methods (see ). Determines whether a type is nullable, ie. whether variables of it can be assigned . The type to check. true if is nullable; otherwise, false. A type is nullable if it is a reference type or a nullable value type. This method returns false only for non-nullable value types. Represents a data source in a query that adds new data items in addition to those provided by the . In C#, the second "from" clause in the following sample corresponds to an : var query = from s in Students from f in s.Friends select f; Base class for and . Common interface for from clauses ( and ). From clauses define query sources that provide data items to the query which are filtered, ordered, projected, or otherwise processed by the following clauses. Represents a clause within the . Implemented by , , , and . Transforms all the expressions in this clause and its child objects via the given delegate. The transformation object. This delegate is called for each within this clause, and those expressions will be replaced with what the delegate returns. Represents a clause or result operator that generates items which are streamed to the following clauses or operators. Gets the name of the items generated by this . Item names are inferred when a query expression is parsed, and they usually correspond to the variable names present in that expression. However, note that names are not necessarily unique within a . Use names only for readability and debugging, not for uniquely identifying objects. To match an with its references, use the property rather than the . Gets the type of the items generated by this . Copies the 's attributes, i.e. the , , and . The expression generating the data items for this from clause. Initializes a new instance of the class. A name describing the items generated by the from clause. The type of the items generated by the from clause. The generating data items for this from clause. Transforms all the expressions in this clause and its child objects via the given delegate. The transformation object. This delegate is called for each within this clause, and those expressions will be replaced with what the delegate returns. Gets or sets a name describing the items generated by this from clause. Item names are inferred when a query expression is parsed, and they usually correspond to the variable names present in that expression. However, note that names are not necessarily unique within a . Use names only for readability and debugging, not for uniquely identifying objects. To match an with its references, use the property rather than the . Gets or sets the type of the items generated by this from clause. Changing the of a can make all objects that point to that invalid, so the property setter should be used with care. The expression generating the data items for this from clause. Represents a clause in a 's collection. Body clauses take the items generated by the , filtering (), ordering (), augmenting (), or otherwise processing them before they are passed to the . Accepts the specified visitor by calling one of its Visit... methods. The visitor to accept. The query model in whose context this clause is visited. The index of this clause in the 's collection. Clones this clause, registering its clone with the if it is a query source clause. The clones of all query source clauses are registered with this . A clone of this clause. Initializes a new instance of the class. A name describing the items generated by the from clause. The type of the items generated by the from clause. The generating the items of this from clause. Accepts the specified visitor by calling its method. The visitor to accept. The query model in whose context this clause is visited. The index of this clause in the 's collection. Clones this clause, registering its clone with the . The clones of all query source clauses are registered with this . A clone of this clause. Aggregates all objects needed in the process of cloning a and its clauses. Gets the clause mapping used during the cloning process. This is used to adjust the instances of clauses to point to clauses in the cloned . This interface should be implemented by visitors that handle the instances. This interface should be implemented by visitors that handle VB-specific expressions. Wraps an exception whose partial evaluation caused an exception. When encounters an exception while evaluating an independent expression subtree, it will wrap the subtree within a . The wrapper contains both the instance and the that caused the exception. To explicitly support this expression type, implement . To ignore this wrapper and only handle the inner , call the method and visit the result. Subclasses of that do not implement will, by default, automatically reduce this expression type to the in the method. Subclasses of that do not implement will, by default, ignore this expression and visit its child expressions via the and methods. Represents an expression tree node that points to a query source represented by a . These expressions should always point back, to a clause defined prior to the clause holding a . Otherwise, exceptions might be thrown at runtime. This particular expression overrides , i.e. it can be compared to another based on the . Determines whether the specified is equal to the current by comparing the properties for reference equality. The to compare with the current . if the specified is a that points to the same ; otherwise, false. Gets the query source referenced by this expression. The referenced query source. Represents an that holds a subquery. The subquery is held by in its parsed form. Represents a VB-specific comparison expression. To explicitly support this expression type, implement . To treat this expression as if it were an ordinary , call its method and visit the result. Subclasses of that do not implement will, by default, automatically reduce this expression type to in the method. Subclasses of that do not implement will, by default, ignore this expression and visit its child expressions via the and methods. Constructs a that is able to extract a specific simple expression from a complex or . For example, consider the task of determining the value of a specific query source [s] from an input value corresponding to a complex expression. This will return a able to perform this task. If the complex expression is [s], it will simply return input => input. If the complex expression is new { a = [s], b = "..." }, it will return input => input.a. If the complex expression is new { a = new { b = [s], c = "..." }, d = "..." }, it will return input => input.a.b. Provides a base class for expression visitors used with re-linq, adding support for and . Adjusts the arguments for a so that they match the given members. The arguments to adjust. The members defining the required argument types. A sequence of expressions that are equivalent to , but converted to the associated member's result type if needed. Constructs a that is able to extract a specific simple from a complex . The expression an accessor to which should be created. The full expression containing the . The input parameter to be used by the resulting lambda. Its type must match the type of . The compares the via reference equality, which means that exactly the same expression reference must be contained by for the visitor to return the expected result. In addition, the visitor can only provide accessors for expressions nested in or . A acting as an accessor for the when an input matching is given. Takes an expression and replaces all instances, as defined by a given . This is used whenever references to query sources should be replaced by a transformation. Takes an expression and replaces all instances, as defined by a given . The expression to be scanned for references. The clause mapping to be used for replacing instances. If , the visitor will throw an exception when not mapped in the is encountered. If , the visitor will ignore such expressions. An expression with its instances replaced as defined by the . Performs a reverse operation, i.e. creates a from a given resolved expression, substituting all objects by getting the referenced objects from the lambda's input parameter. Given the following input: ItemExpression: new AnonymousType ( a = [s1], b = [s2] ) ResolvedExpression: [s1].ID + [s2].ID The visitor generates the following : input => input.a.ID + input.b.ID The lambda's input parameter has the same type as the ItemExpression. Performs a reverse operation, i.e. creates a from a given resolved expression, substituting all objects by getting the referenced objects from the lambda's input parameter. The item expression representing the items passed to the generated via its input parameter. The resolved expression for which to generate a reverse resolved . A from the given resolved expression, substituting all objects by getting the referenced objects from the lambda's input parameter. The generated has exactly one parameter which is of the type defined by . Performs a reverse operation on a , i.e. creates a new with an additional parameter from a given resolved , substituting all objects by getting the referenced objects from the new input parameter. The item expression representing the items passed to the generated via its new input parameter. The resolved for which to generate a reverse resolved . The position at which to insert the new parameter. A similar to the given resolved expression, substituting all objects by getting the referenced objects from an additional input parameter. The new input parameter is of the type defined by . Represents the join part of a query, adding new data items and joining them with data items from previous clauses. In contrast to , the does not provide access to the individual items of the joined query source. Instead, it provides access to all joined items for each item coming from the previous clauses, thus grouping them together. The semantics of this join is so that for all input items, a joined sequence is returned. That sequence can be empty if no joined items are available. In C#, the "into" clause in the following sample corresponds to a . The "join" part before that is encapsulated as a held in . The adds a new query source to the query ("addresses"), but the item type of that query source is , not "Address". Therefore, it can be used in the of an to extract the single items. var query = from s in Students join a in Addresses on s.AdressID equals a.ID into addresses from a in addresses select new { s, a }; Transforms all the expressions in this clause and its child objects via the given delegate. The transformation object. This delegate is called for each within this clause, and those expressions will be replaced with what the delegate returns. Accepts the specified visitor by calling its method. The visitor to accept. The query model in whose context this clause is visited. The index of this clause in the 's collection. Clones this clause, registering its clone with the . The clones of all query source clauses are registered with this . A clone of this clause. Gets or sets a name describing the items generated by this . Item names are inferred when a query expression is parsed, and they usually correspond to the variable names present in that expression. However, note that names are not necessarily unique within a . Use names only for readability and debugging, not for uniquely identifying objects. To match an with its references, use the property rather than the . Gets or sets the type of the items generated by this . This must implement . Changing the of a can make all objects that point to that invalid, so the property setter should be used with care. Gets or sets the inner join clause of this . The represents the actual join operation performed by this clause; its results are then grouped by this clause before streaming them to subsequent clauses. objects outside the must not point to because the items generated by it are only available in grouped form from outside this clause. Represents the join part of a query, adding new data items and joining them with data items from previous clauses. This can either be part of or of . The semantics of the is that of an inner join, i.e. only combinations where both an input item and a joined item exist are returned. In C#, the "join" clause in the following sample corresponds to a . The adds a new query source to the query, selecting addresses (called "a") from the source "Addresses". It associates addresses and students by comparing the students' "AddressID" properties with the addresses' "ID" properties. "a" corresponds to and , "Addresses" is and the left and right side of the "equals" operator are held by and , respectively: var query = from s in Students join a in Addresses on s.AdressID equals a.ID select new { s, a }; Initializes a new instance of the class. A name describing the items generated by this . The type of the items generated by this . The expression that generates the inner sequence, i.e. the items of this . An expression that selects the left side of the comparison by which source items and inner items are joined. An expression that selects the right side of the comparison by which source items and inner items are joined. Accepts the specified visitor by calling its method. The visitor to accept. The query model in whose context this clause is visited. The index of this clause in the 's collection. Accepts the specified visitor by calling its method. This overload is used when visiting a that is held by a . The visitor to accept. The query model in whose context this clause is visited. The holding this instance. Clones this clause, registering its clone with the . The clones of all query source clauses are registered with this . A clone of this clause. Transforms all the expressions in this clause and its child objects via the given delegate. The transformation object. This delegate is called for each within this clause, and those expressions will be replaced with what the delegate returns. Gets or sets the type of the items generated by this . Changing the of a can make all objects that point to that invalid, so the property setter should be used with care. Gets or sets a name describing the items generated by this . Item names are inferred when a query expression is parsed, and they usually correspond to the variable names present in that expression. However, note that names are not necessarily unique within a . Use names only for readability and debugging, not for uniquely identifying objects. To match an with its references, use the property rather than the . Gets or sets the inner sequence, the expression that generates the inner sequence, i.e. the items of this . The inner sequence. Gets or sets the outer key selector, an expression that selects the right side of the comparison by which source items and inner items are joined. The outer key selector. Gets or sets the inner key selector, an expression that selects the left side of the comparison by which source items and inner items are joined. The inner key selector. Represents the main data source in a query, producing data items that are filtered, aggregated, projected, or otherwise processed by subsequent clauses. In C#, the first "from" clause in the following sample corresponds to the : var query = from s in Students from f in s.Friends select f; Initializes a new instance of the class. A name describing the items generated by the from clause. The type of the items generated by the from clause. The generating data items for this from clause. Accepts the specified visitor by calling its method. The visitor to accept. The query model in whose context this clause is visited. Clones this clause, registering its clone with the . The clones of all query source clauses are registered with this . A clone of this clause. Represents the orderby part of a query, ordering data items according to some . In C#, the whole "orderby" clause in the following sample (including two orderings) corresponds to an : var query = from s in Students orderby s.Last, s.First select s; Initializes a new instance of the class. Accepts the specified visitor by calling its method. The visitor to accept. The query model in whose context this clause is visited. The index of this clause in the 's collection. Transforms all the expressions in this clause and its child objects via the given delegate. The transformation object. This delegate is called for each within this clause, and those expressions will be replaced with what the delegate returns. Clones this clause. The clones of all query source clauses are registered with this . A clone of this clause. Gets the instances that define how to sort the items coming from previous clauses. The order of the in the collection defines their priorities. For example, { LastName, FirstName } would sort all items by LastName, and only those items that have equal LastName values would be sorted by FirstName. Represents a single ordering instruction in an . Initializes a new instance of the class. The expression used to order the data items returned by the query. The to use for sorting. Accepts the specified visitor by calling its method. The visitor to accept. The query model in whose context this clause is visited. The in whose context this item is visited. The index of this item in the 's collection. Clones this item. The clones of all query source clauses are registered with this . A clone of this item. Transforms all the expressions in this item via the given delegate. The transformation object. This delegate is called for each within this item, and those expressions will be replaced with what the delegate returns. Gets or sets the expression used to order the data items returned by the query. The expression. Gets or sets the direction to use for ordering data items. Specifies the direction used to sort the result items in a query using an . Sorts the items in an ascending way, from smallest to largest. Sorts the items in an descending way, from largest to smallest. Maps instances to instances. This is used by in order to be able to correctly update references to old clauses to point to the new clauses. Via , it can also be used manually. Represents an operation that is executed on the result set of the query, aggregating, filtering, or restricting the number of result items before the query result is returned. Executes this result operator in memory, on a given input. Executing result operators in memory should only be performed if the target query system does not support the operator. The input for the result operator. This must match the type of expected by the operator. The result of the operator. Gets information about the data streamed out of this . This contains the result type a query would have if it ended with this , and it optionally includes an describing the streamed sequence's items. Information about the data produced by the preceding , or the of the query if no previous exists. Gets information about the data streamed out of this . Clones this item, registering its clone with the if it is a query source clause. The clones of all query source clauses are registered with this . A clone of this item. Accepts the specified visitor by calling its method. The visitor to accept. The query model in whose context this clause is visited. The index of this item in the 's collection. Transforms all the expressions in this item via the given delegate. Subclasses must apply the to any expressions they hold. If a subclass does not hold any expressions, it shouldn't do anything in the implementation of this method. The transformation object. This delegate is called for each within this item, and those expressions will be replaced with what the delegate returns. Invokes the given via reflection on the given . The input to invoke the method with. The method to be invoked. The result of the invocation Gets the constant value of the given expression, assuming it is a . If it is not, an is thrown. The expected value type. If the value is not of this type, an is thrown. A string describing the value; this will be included in the exception message if an exception is thrown. The expression whose value to get. The constant value of the given . Represents aggregating the items returned by a query into a single value with an initial seeding value. This is a result operator, operating on the whole result set of a query. In C#, the "Aggregate" call in the following example corresponds to an . var result = (from s in Students select s).Aggregate(0, (totalAge, s) => totalAge + s.Age); Represents a that is executed on a sequence, returning a scalar value or single item as its result. Initializes a new instance of the class. The seed expression. The aggregating function. This is a taking a parameter that represents the value accumulated so far and returns a new accumulated value. This is a resolved expression, i.e. items streaming in from prior clauses and result operators are represented as expressions containing nodes. The result selector, can be . Gets the constant value of the property, assuming it is a . If it is not, an is thrown. The expected seed type. If the item is not of this type, an is thrown. The constant value of the property. Executes the aggregating operation in memory. The type of the source items. The type of the aggregated items. The type of the result items. The input sequence. A object holding the aggregated value. Gets or sets the aggregating function. This is a taking a parameter that represents the value accumulated so far and returns a new accumulated value. This is a resolved expression, i.e. items streaming in from prior clauses and result operators are represented as expressions containing nodes. The aggregating function. Gets or sets the seed of the accumulation. This is an denoting the starting value of the aggregation. The seed of the accumulation. Gets or sets the result selector. This is a applied after the aggregation to select the final value. Can be . The result selector. Represents aggregating the items returned by a query into a single value. The first item is used as the seeding value for the aggregating function. This is a result operator, operating on the whole result set of a query. In C#, the "Aggregate" call in the following example corresponds to an . var result = (from s in Students select s.Name).Aggregate((allNames, name) => allNames + " " + name); Initializes a new instance of the class. The aggregating function. This is a taking a parameter that represents the value accumulated so far and returns a new accumulated value. This is a resolved expression, i.e. items streaming in from prior clauses and result operators are represented as expressions containing nodes. Gets or sets the aggregating function. This is a taking a parameter that represents the value accumulated so far and returns a new accumulated value. This is a resolved expression, i.e. items streaming in from prior clauses and result operators are represented as expressions containing nodes. The aggregating function. Represents a check whether all items returned by a query satisfy a predicate. This is a result operator, operating on the whole result set of a query. In C#, the "All" call in the following example corresponds to an . var result = (from s in Students select s).All(); Initializes a new instance of the class. The predicate to evaluate. This is a resolved version of the body of the that would be passed to . Gets or sets the predicate to evaluate on all items in the sequence. This is a resolved version of the body of the that would be passed to . The predicate. Represents a check whether any items are returned by a query. This is a result operator, operating on the whole result set of a query. "Any" query methods taking a predicate are represented as into a combination of a and an . In C#, the "Any" call in the following example corresponds to an . var result = (from s in Students select s).Any(); Represents a calculation of an average value from the items returned by a query. This is a result operator, operating on the whole result set of a query. In C#, the "Average" call in the following example corresponds to an . var query = (from s in Students select s.ID).Average(); Represents a cast of the items returned by a query to a different type. This is a result operator, operating on the whole result set of a query. In C#, "Cast" call in the following example corresponds to a . var query = (from s in Students select s.ID).Cast<int>(); Represents a that is executed on a sequence, returning a new sequence as its result. Represents a that is executed on a sequence, choosing a single item for its result. Represents concatenating the items returned by a query with a given set of items, similar to the but retaining duplicates (and order). This is a result operator, operating on the whole result set of a query. In C#, the "Concat" call in the following example corresponds to a . var query = (from s in Students select s).Concat(students2); Gets the value of , assuming holds a . If it doesn't, an is thrown. The constant value of . Gets or sets the second source of this result operator, that is, an enumerable containing the items concatenated with the input sequence. Represents a check whether the results returned by a query contain a specific item. This is a result operator, operating on the whole result set of a query. In C#, the "Contains" call in the following example corresponds to a . var query = (from s in Students select s).Contains (student); Initializes a new instance of the class. The item for which to be searched. Gets the constant value of the property, assuming it is a . If it is not, an is thrown. The expected item type. If the item is not of this type, an is thrown. The constant value of the property. Gets or sets an expression yielding the item for which to be searched. This must be compatible with (ie., assignable to) the source sequence items. The item expression. Represents counting the number of items returned by a query. This is a result operator, operating on the whole result set of a query. "Count" query methods taking a predicate are represented as a combination of a and a . /// In C#, the "Count" call in the following example corresponds to a . var query = (from s in Students select s).Count(); Represents a guard clause yielding a singleton sequence with a default value if no items are returned by a query. This is a result operator, operating on the whole result set of a query. In C#, the "Defaultifempty" call in the following example corresponds to a . var query = (from s in Students select s).DefaultIfEmpty ("student"); Represents a that is executed on a sequence, returning a new sequence with the same item type as its result. Gets the constant value of the property, assuming it is a . If it is not, an is thrown. If it is , is returned. The constant value of the property. Gets or sets the optional default value. The optional default value. Represents the removal of duplicate values from the items returned by a query. This is a result operator, operating on the whole result set of a query. In C#, the "Distinct" call in the following example corresponds to a . var query = (from s in Students select s).Distinct(); Represents the removal of a given set of items from the result set of a query. This is a result operator, operating on the whole result set of a query. In C#, the "Except" call in the following example corresponds to a . var query = (from s in Students select s).Except(students2); Gets the value of , assuming holds a . If it doesn't, an is thrown. The constant value of . Gets or sets the second source of this result operator, that is, an enumerable containing the items removed from the input sequence. Represents taking only the first of the items returned by a query. This is a result operator, operating on the whole result set of a query. "First" query methods taking a predicate are represented as a combination of a and a . In C#, the "First" call in the following example corresponds to a . var query = (from s in Students select s).First(); Initializes a new instance of the . The flag defines if a default expression should be regarded. Represents grouping the items returned by a query according to some key retrieved by a , applying by an to the grouped items. This is a result operator, operating on the whole result set of the query. In C#, the "group by" clause in the following sample corresponds to a . "s" (a reference to the query source "s", see ) is the expression, "s.Country" is the expression: var query = from s in Students where s.First == "Hugo" group s by s.Country; Initializes a new instance of the class. A name associated with the items generated by the result operator. The selector retrieving the key by which to group items. The selector retrieving the elements to group. Clones this clause, adjusting all instances held by it as defined by . The clones of all query source clauses are registered with this . A clone of this clause. Transforms all the expressions in this clause and its child objects via the given delegate. The transformation object. This delegate is called for each within this clause, and those expressions will be replaced with what the delegate returns. Gets or sets the name of the items generated by this . Item names are inferred when a query expression is parsed, and they usually correspond to the variable names present in that expression. However, note that names are not necessarily unique within a . Use names only for readability and debugging, not for uniquely identifying objects. To match an with its references, use the property rather than the . Gets or sets the type of the items generated by this . The item type is an instantiation of derived from the types of and . Gets or sets the selector retrieving the key by which to group items. This is a resolved version of the body of the that would be passed to . The key selector. Gets or sets the selector retrieving the elements to group. This is a resolved version of the body of the that would be passed to . The element selector. Represents taking the mathematical intersection of a given set of items and the items returned by a query. This is a result operator, operating on the whole result set of a query. In C#, the "Intersect" call in the following example corresponds to a . var query = (from s in Students select s).Intersect(students2); Gets the value of , assuming holds a . If it doesn't, an is thrown. The constant value of . Gets or sets the second source of this result operator, that is, an enumerable containing the items intersected with the input sequence. Represents taking only the last one of the items returned by a query. This is a result operator, operating on the whole result set of a query. "Last" query methods taking a predicate are represented as a combination of a and a . In C#, the "Last" call in the following example corresponds to a . var query = (from s in Students select s).Last(); Initializes a new instance of the . The flag defines if a default expression should be regarded. Represents counting the number of items returned by a query as a 64-bit number. This is a result operator, operating on the whole result set of a query. "LongCount" query methods taking a predicate are represented as a combination of a and a . In C#, the "LongCount" call in the following example corresponds to a . var query = (from s in Students select s).LongCount(); Represents taking only the greatest one of the items returned by a query. This is a result operator, operating on the whole result set of a query. The semantics of "greatest" are defined by the query provider. "Max" query methods taking a selector are represented as a combination of a and a . In C#, the "Max" call in the following example corresponds to a . var query = (from s in Students select s.ID).Max(); Initializes a new instance of the . Represents taking only the smallest one of the items returned by a query. This is a result operator, operating on the whole result set of a query. The semantics of "smallest" are defined by the query provider. "Min" query methods taking a selector are represented as a combination of a and a . In C#, the "Min" call in the following example corresponds to a . var query = (from s in Students select s.ID).Min(); Initializes a new instance of the . Represents filtering the items returned by a query to only return those items that are of a specific type. This is a result operator, operating on the whole result set of a query. In C#, the "OfType" call in the following example corresponds to a . var query = (from s in Students select s.ID).OfType<int>(); Represents reversing the sequence of items returned by of a query. This is a result operator, operating on the whole result set of a query. In C#, the "Reverse" call in the following example corresponds to a . var query = (from s in Students select s).Reverse(); Represents taking the single item returned by a query. This is a result operator, operating on the whole result set of a query. In C#, the "Single" call in the following example corresponds to a . var query = (from s in Students select s).Single(); Initializes a new instance of the . The flag defines if a default expression should be regarded. Represents skipping a number of the items returned by a query. This is a result operator, operating on the whole result set of a query. In C#, the "Skip" call in the following example corresponds to a . var query = (from s in Students select s).Skip (3); Gets the constant value of the property, assuming it is a . If it is not, an is thrown. The constant value of the property. Represents calculating the sum of the items returned by a query. This is a result operator, operating on the whole result set of a query. In C#, the "Sum" call in the following example corresponds to a . var query = (from s in Students select s.ID).Sum(); Represents taking only a specific number of items returned by a query. This is a result operator, operating on the whole result set of a query. In C#, the "Take" call in the following example corresponds to a . var query = (from s in Students select s).Take(3); Initializes a new instance of the . The number of elements which should be returned. Gets the constant value of the property, assuming it is a . If it is not, an is thrown. The constant value of the property. Represents forming the mathematical union of a given set of items and the items returned by a query. This is a result operator, operating on the whole result set of a query. In C#, the "Union" call in the following example corresponds to a . var query = (from s in Students select s).Union(students2); Gets the value of , assuming holds a . If it doesn't, an is thrown. The constant value of . Gets or sets the second source of this result operator, that is, an enumerable containing the items united with the input sequence. Represents the select part of a query, projecting data items according to some . In C#, the "select" clause in the following sample corresponds to a . "s" (a reference to the query source "s", see ) is the expression: var query = from s in Students where s.First == "Hugo" select s; Initializes a new instance of the class. The selector that projects the data items. Accepts the specified visitor by calling its method. The visitor to accept. The query model in whose context this clause is visited. Clones this clause. The clones of all query source clauses are registered with this . A clone of this clause. Transforms all the expressions in this clause and its child objects via the given delegate. The transformation object. This delegate is called for each within this clause, and those expressions will be replaced with what the delegate returns. Gets an object describing the data streaming out of this . If a query ends with the , this corresponds to the query's output data. If a query has , the data is further modified by those operators. Use to obtain the real result type of a query model, including the . Gets a object describing the data streaming out of this . The data streamed from a is always of type instantiated with the type of as its generic parameter. Its corresponds to the . Gets the selector defining what parts of the data items are returned by the query. Holds the data needed to represent the output or input of a part of a query in memory. This is mainly used for . The data held by implementations of this interface can be either a value or a sequence. Gets an object describing the data held by this instance. An object describing the data held by this instance. Gets the value held by this instance. The value. Describes the data streamed out of a or . Executes the specified with the given , calling either or , depending on the type of data streamed from this interface. The query model to be executed. The executor to use. An object holding the results of the query execution. Returns a new of the same type as this instance, but with a new . The type to use for the property. The type must be compatible with the data described by this , otherwise an exception is thrown. The type may be a generic type definition if the supports generic types; in this case, the type definition is automatically closed with generic parameters to match the data described by this . A new of the same type as this instance, but with a new . The is not compatible with the data described by this . Gets the type of the data described by this instance. For a sequence, this is a type implementing , where T is instantiated with a concrete type. For a single value, this is the value type. Describes a scalar value streamed out of a or . A scalar value corresponds to a value calculated from the result set, as produced by or , for instance. Describes a single or scalar value streamed out of a or . Returns a new instance of the same type with a different . The new data type. The cannot be used for the clone. A new instance of the same type with the given . Gets the type of the data described by this instance. This is the type of the streamed value, or if the value is . Holds the data needed to represent the output or input of a part of a query in memory. This is mainly used for . The data consists of a sequence of items. Initializes a new instance of the class, setting the and properties. The sequence. An instance of describing the sequence. Gets the current sequence held by this object as well as an describing the sequence's items, throwing an exception if the object does not hold a sequence of items of type . The expected item type of the sequence. The sequence and an describing its items. Thrown when the item type is not the expected type . Gets the current sequence for the operation. If the object is used as input, this holds the input sequence for the operation. If the object is used as output, this holds the result of the operation. The current sequence. Describes sequence data streamed out of a or . Sequence data can be held by an object implementing , and its items are described via a . Returns a new with an adjusted . The type to use for the property. The type must be convertible from the previous type, otherwise an exception is thrown. The type may be a generic type definition; in this case, the type definition is automatically closed with the type of the . A new with a new . The is not compatible with the items described by this . Gets the type of the items returned by the sequence described by this object, as defined by . Note that because is covariant starting from .NET 4.0, this may be a more abstract type than what's returned by 's property. Gets an expression that describes the structure of the items held by the sequence described by this object. The expression for the sequence's items. Gets the type of the data described by this instance. This is a type implementing , where T is instantiated with a concrete type. Describes a single value streamed out of a or . A single value corresponds to one item from the result set, as produced by or , for instance. Holds the data needed to represent the output or input of a part of a query in memory. This is mainly used for . The data is a single, non-sequence value and can only be consumed by result operators working with single values. Initializes a new instance of the class, setting the and properties. The value. A describing the value. Gets the value held by , throwing an exception if the value is not of type . The expected type of the value. , cast to . Thrown when if not of the expected type. Gets an object describing the data held by this instance. An object describing the data held by this instance. Gets the current value for the operation. If the object is used as input, this holds the input value for the operation. If the object is used as output, this holds the result of the operation. The current value. Represents the where part of a query, filtering data items according to some . In C#, the "where" clause in the following sample corresponds to a : var query = from s in Students where s.First == "Hugo" select s; Initializes a new instance of the class. The predicate used to filter data items. Accepts the specified visitor by calling its method. The visitor to accept. The query model in whose context this clause is visited. The index of this clause in the 's collection. Transforms all the expressions in this clause and its child objects via the given delegate. The transformation object. This delegate is called for each within this clause, and those expressions will be replaced with what the delegate returns. Clones this clause. The clones of all query source clauses are registered with this . Gets the predicate, the expression representing the where condition by which the data items are filtered Provides a way to enumerate an while items are inserted, removed, or cleared in a consistent fashion. The element type of the . This class subscribes to the event exposed by and reacts on changes to the collection. If an item is inserted or removed before the current element, the enumerator will continue after the current element without regarding the new or removed item. If the current item is removed, the enumerator will continue with the item that previously followed the current item. If an item is inserted or removed after the current element, the enumerator will simply continue, including the newly inserted item and not including the removed item. If an item is moved or replaced, the enumeration will also continue with the item located at the next position in the sequence. Represents an item enumerated by . This provides access to the as well as the of the enumerated item. Gets the index of the current enumerated item. Can only be called while enumerating, afterwards, it will throw an . If an item is inserted into or removed from the collection before the current item, this index will change. Gets the value of the current enumerated item. Can only be called while enumerating, afterwards, it will throw an . The value. Defines extension methods that simplify working with a dictionary that has a collection-values item-type. Extension methods for Returns an instance of that represents this collection and can be enumerated even while the collection changes; the enumerator will adapt to the changes (see ). Returns an instance of that represents this collection and can be enumerated even while the collection changes; the enumerator will adapt to the changes (see ). The enumerable will yield instances of type , which hold both the index and the value of the current item. If this collection changes while enumerating, will reflect those changes. Represents a default implementation of that is automatically used by unless a custom is specified. The executes queries by parsing them into an instance of type , which is then passed to an implementation of to obtain the result set. Provides a default implementation of that executes queries (subclasses of ) by first parsing them into a and then passing that to a given implementation of . Usually, should be used unless must be manually implemented. Initializes a new instance of using a custom . Use this constructor to customize how queries are parsed. The used to parse queries. Specify an instance of for default behavior. The used to execute queries against a specific query backend. Constructs an object that can evaluate the query represented by a specified expression tree. This method delegates to . An expression tree that represents a LINQ query. An that can evaluate the query represented by the specified expression tree. Constructs an object that can evaluate the query represented by a specified expression tree. This method is called by the standard query operators defined by the class. An expression tree that represents a LINQ query. An that can evaluate the query represented by the specified expression tree. Executes the query defined by the specified expression by parsing it with a and then running it through the . This method is invoked through the interface methods, for example by and , and it's also used by when the is enumerated. Override this method to replace the query execution mechanism by a custom implementation. Executes the query defined by the specified expression by parsing it with a and then running it through the . The result is cast to . The type of the query result. The query expression to be executed. The result of the query cast to . This method is called by the standard query operators that return a single value, such as or . In addition, it is called by to execute queries that return sequences. Executes the query defined by the specified expression by parsing it with a and then running it through the . The query expression to be executed. The result of the query. This method is similar to the method, but without the cast to a defined return type. The method generates a . The query as expression chain. a Gets the used by this to parse LINQ queries. The query parser. Gets or sets the implementation of used to execute queries created via . The executor used to execute queries. Initializes a new instance of using a custom . A type implementing . This type is used to construct the chain of query operators. Must be a generic type definition. The used to parse queries. Specify an instance of for default behavior. See also . The used to execute queries against a specific query backend. Creates a new (of type with as its generic argument) that represents the query defined by and is able to enumerate its results. The type of the data items returned by the query. An expression representing the query for which a should be created. An that represents the query defined by . Gets the type of queryable created by this provider. This is the generic type definition of an implementation of (usually a subclass of ) with exactly one type argument. Constitutes the bridge between re-linq and a concrete query provider implementation. Concrete providers implement this interface and calls the respective method of the interface implementation when a query is to be executed. Executes the given as a scalar query, i.e. as a query returning a scalar value of type . The query ends with a scalar result operator, for example a or a . The type of the scalar value returned by the query. The representing the query to be executed. Analyze this via an . A scalar value of type that represents the query's result. The difference between and is in the kind of object that is returned. is used when a query that would otherwise return a collection result set should pick a single value from the set, for example the first, last, minimum, maximum, or only value in the set. is used when a value is calculated or aggregated from all the values in the collection result set. This applies to, for example, item counts, average calculations, checks for the existence of a specific item, and so on. Executes the given as a single object query, i.e. as a query returning a single object of type . The query ends with a single result operator, for example a or a . The type of the single value returned by the query. The representing the query to be executed. Analyze this via an . If , the executor must return a default value when its result set is empty; if , it should throw an when its result set is empty. A single value of type that represents the query's result. The difference between and is in the kind of object that is returned. is used when a query that would otherwise return a collection result set should pick a single value from the set, for example the first, last, minimum, maximum, or only value in the set. is used when a value is calculated or aggregated from all the values in the collection result set. This applies to, for example, item counts, average calculations, checks for the existence of a specific item, and so on. Executes the given as a collection query, i.e. as a query returning objects of type . The query does not end with a scalar result operator, but it can end with a single result operator, for example or . In such a case, the returned enumerable must yield exactly one object (or none if the last result operator allows empty result sets). The type of the items returned by the query. The representing the query to be executed. Analyze this via an . A scalar value of type that represents the query's result. Defines an interface for visiting the clauses of a . When implement this interface, implement , then call Accept on every clause that should be visited. Child clauses, joins, orderings, and result operators are not visited automatically; they always need to be explicitly visited via , , , , and so on. provides a robust default implementation of this interface that can be used as a base for other visitors. Represents a being bound to an associated instance. This binding's method returns only for the same the expression is bound to. Represents a being bound to an associated instance. This is used by the to represent assignments in constructor calls such as new AnonymousType (a = 5), where a is the member of AnonymousType and 5 is the associated expression. The method can be used to check whether the member bound to an expression matches a given (considering read access). See the subclasses for details. Represents a being bound to an associated instance. This binding's method returns for the same the expression is bound to or for a whose getter method is the the expression is bound to. Represents a being bound to an associated instance. This binding's method returns for the same the expression is bound to or for its getter method's . Replaces nodes according to a given mapping specification. Expressions are also replaced within subqueries; the is changed by the replacement operations, it is not copied. The replacement node is not recursively searched for occurrences of nodes to be replaced. Takes an expression tree and first analyzes it for evaluatable subtrees (using ), i.e. subtrees that can be pre-evaluated before actually generating the query. Examples for evaluatable subtrees are operations on constant values (constant folding), access to closure variables (variables used by the LINQ query that are defined in an outer scope), or method calls on known objects or their members. In a second step, it replaces all of the evaluatable subtrees (top-down and non-recursive) by their evaluated counterparts. This visitor visits each tree node at most twice: once via the for analysis and once again to replace nodes if possible (unless the parent node has already been replaced). Takes an expression tree and finds and evaluates all its evaluatable subtrees. Evaluates an evaluatable subtree, i.e. an independent expression tree that is compilable and executable without any data being passed in. The result of the evaluation is returned as a ; if the subtree is already a , no evaluation is performed. The subtree to be evaluated. A holding the result of the evaluation. Replaces all nodes that equal a given with a replacement node. Expressions are also replaced within subqueries; the is changed by the replacement operations, it is not copied. The replacement node is not recursively searched for occurrences of the to be replaced. Preprocesses an expression tree for parsing. The preprocessing involves detection of sub-queries and VB-specific expressions. Transforms a given . If the can handle the , it should return a new, transformed instance. Otherwise, it should return the input instance. The expression to be transformed. The result of the transformation, or if no transformation was applied. Manages registration and lookup of objects, and converts them to weakly typed instances. Use this class together with in order to apply the registered transformers to an tree. defines an API for classes returning instances for specific objects. Usually, the will be used when an implementation of this interface is needed. Gets the transformers for the given . The to be transformed. A sequence containing objects that should be applied to the . Must not be . Creates an with the default transformations provided by this library already registered. New transformers can be registered by calling . A default . Currently, the default registry contains: Registers the specified for the transformer's . If returns , the is registered as a generic transformer which will be applied to all nodes. The type of expressions handled by the . This should be a type implemented by all expressions identified by . For generic transformers, must be . The transformer to register. The order in which transformers are registered is the same order on which they will later be applied by . When more than one transformer is registered for a certain , each of them will get a chance to transform a given , until the first one returns a new . At that point, the transformation will start again with the new (and, if the expression's type has changed, potentially different transformers). When generic transformers are registered, they act as if they had been registered for all values (including custom ones). They will be applied in the order registered, but only after all respective specific transformers have run (without modifying the expression, which would restart the transformation process with the new expression as explained above). When an is registered for an incompatible , this is not detected until the transformer is actually applied to an of that . is implemented by classes that transform instances. The manages registration of instances, and the applies the transformations. The type of expressions handled by this implementation. is a convenience interface that provides strong typing, whereas only operates on instances. can be used together with the class by using the class as the transformation provider. converts strongly typed instances to weakly typed delegate instances. Transforms a given . If the implementation can handle the , it should return a new, transformed instance. Otherwise, it should return the input instance. The expression to be transformed. The result of the transformation, or if no transformation was applied. Gets the expression types supported by this . The supported expression types. Return to support all expression types. (This is only sensible when is .) Dynamically discovers attributes implementing the interface on methods and get accessors invoked by or instances and applies the respective . Defines an interface for attributes providing an for a given . detects attributes implementing this interface while expressions are parsed and uses the returned by to modify the expressions. Only one attribute instance implementing must be applied to a single method or property get accessor. Detects nodes for and adds metadata to those nodes. This allows LINQ providers to match member access and constructor arguments more easily. Provides a base class for transformers detecting nodes for tuple types and adding metadata to those nodes. This allows LINQ providers to match member access and constructor arguments more easily. Detects expressions invoking a and replaces them with the body of that (with the parameter references replaced with the invocation arguments). Providers use this transformation to be able to handle queries with instances. When the is applied to a delegate instance (rather than a ), the ignores it. Detects nodes for and adds metadata to those nodes. This allows LINQ providers to match member access and constructor arguments more easily. Chooses a given for a specific method (or property get accessor). The must have a default constructor. To choose a transformer that does not have a default constructor, create your own custom attribute class implementing . Replaces calls to and with casts and null checks. This allows LINQ providers to treat nullables like reference types. Detects nodes for the .NET tuple types and adds metadata to those nodes. This allows LINQ providers to match member access and constructor arguments more easily. Detects expressions calling the CompareString method used by Visual Basic .NET, and replaces them with instances. Providers use this transformation to be able to handle VB string comparisons more easily. See for details. Detects expressions calling the Information.IsNothing (...) method used by Visual Basic .NET, and replaces them with instances comparing with . Providers use this transformation to be able to handle queries using IsNothing (...) more easily. Applies delegates obtained from an to an expression tree. The transformations occur in post-order (transforming child nodes before parent nodes). When a transformation changes the current , its child nodes and itself will be revisited (and may be transformed again). Replaces expression patterns of the form new T { x = 1, y = 2 }.x () or new T ( x = 1, y = 2 ).x () to 1 (or 2 if y is accessed instead of x). Expressions are also replaced within subqueries; the is changed by the replacement operations, it is not copied. Base class for typical implementations of the . The interface defines an extension point for disabling partial evaluation on specific nodes. Implement the individual evaluation methods and return to mark a specfic node as not partially evaluatable. Note that the partial evaluation infrastructure will take care of visiting an node's children, so the determination can usually be constrained to the attributes of the node itself. Use the type as a base class for filter implementations that only require testing a few node types, e.g. to disable partial evaluation for individual method calls. Analyzes an expression tree by visiting each of its nodes, finding those subtrees that can be evaluated without modifying the meaning of the tree. An expression node/subtree is evaluatable if: it is not a or any non-standard expression, it is not a that involves an , and it does not have any of those non-evaluatable expressions as its children. nodes are not evaluatable because they usually identify the flow of some information from one query node to the next. nodes that involve parameters or object instances are not evaluatable because they should usually be translated into the target query syntax. In .NET 3.5, non-standard expressions are not evaluatable because they cannot be compiled and evaluated by LINQ. In .NET 4.0, non-standard expressions can be evaluated if they can be reduced to an evaluatable expression. Determines whether the given is one of the expressions defined by for which has a dedicated Visit method. handles those by calling the respective Visit method. The expression to check. Must not be . if is one of the expressions defined by and has a dedicated Visit method for it; otherwise, . Note that -type expressions are considered 'not supported' and will also return . Implementation of the null-object pattern for . Parses an expression tree into a chain of objects after executing a sequence of objects. Creates a default that already has all expression node parser defined by the re-linq assembly registered. Users can add inner providers to register their own expression node parsers. A default that already has all expression node parser defined by the re-linq assembly registered. Creates a default that already has the expression tree processing steps defined by the re-linq assembly registered. Users can insert additional processing steps. The tranformation provider to be used by the included in the result set. Use to create a default provider. The expression filter used by the included in the result set. Use to indicate that no custom filtering should be applied. A default that already has all expression tree processing steps defined by the re-linq assembly registered. The following steps are included: (parameterized with ) Initializes a new instance of the class with a custom and implementation. The to use when parsing trees. Use to create an instance of that already includes all default node types. (The can be customized as needed by adding or removing ). The to apply to trees before parsing their nodes. Use to create an instance of that already includes the default steps. (The can be customized as needed by adding or removing ). Parses the given into a chain of instances, using to convert expressions to nodes. The expression tree to parse. A chain of instances representing the . Gets the query operator represented by . If is already a , that is the assumed query operator. If is a and the member's getter is registered with , a corresponding is constructed and returned. Otherwise, is returned. The expression to get a query operator expression for. A to be parsed as a query operator, or if the expression does not represent a query operator. Infers the associated identifier for the source expression node contained in methodCallExpression.Arguments[0]. For example, for the call chain "source.Where (i => i > 5)" (which actually reads "Where (source, i => i > 5"), the identifier "i" is associated with the node generated for "source". If no identifier can be inferred, is returned. Gets the node type provider used to parse instances in . The node type provider. Gets the processing steps used by to process the tree before analyzing its structure. The processing steps. Implements by storing a list of inner instances. The method calls each inner instance in the order defined by the property. This is an implementation of the Composite Pattern. is implemented by classes that represent steps in the process of parsing the structure of an tree. applies a series of these steps to the tree before analyzing the query operators and creating a . There are predefined implementations of that should only be left out when parsing an tree when there are very good reasons to do so. can be implemented to provide custom, complex transformations on an tree. For performance reasons, avoid adding too many steps each of which visits the whole tree. For simple transformations, consider using and - which can batch several transformations into a single expression tree visiting run - rather than implementing a dedicated . Implements the interface by doing nothing in the method. This is an implementation of the Null Object Pattern. Analyzes an tree for sub-trees that are evaluatable in-memory, and evaluates those sub-trees. The uses the for partial evaluation. It performs two visiting runs over the tree. Applies a given set of transformations to an tree. The transformations are provided by an instance of (eg., ). The uses the to apply the transformations. It performs a single visiting run over the tree. Initializes a new instance of the class. A class providing the transformations to apply to the tree, eg., an instance of . Provides a common interface for classes mapping a to the respective type. Implementations are used by when a is encountered to instantiate the right for the given method. Determines whether a node type for the given can be returned by this . Gets the type of that matches the given , returning if none can be found. Represents a for the and methods. It is generated by when an tree is parsed. When this node is used, it marks the beginning (i.e. the last node) of an chain that represents a query. Acts as a base class for s standing for s that operate on the result of the query rather than representing actual clauses, such as or . Base class for implementations that represent instantiations of . Interface for classes representing structural parts of an tree. Resolves the specified by replacing any occurrence of by the result of the projection of this . The result is an that goes all the way to an . The parameter representing the input data streaming into an . This is replaced by the projection data coming out of this . The expression to be resolved. Any occurrence of in this expression is replaced. Context information used during the current parsing process. This structure maps s to the clauses created from them. Implementers that also implement (such as or ) must add their clauses to the mapping in if they want to be able to implement correctly. An equivalent of with each occurrence of replaced by the projection data streaming out of this . This node does not support this operation because it does not stream any data to subsequent nodes. Applies this to the specified query model. Nodes can add or replace clauses, add or replace expressions, add or replace objects, or even create a completely new , depending on their semantics. The query model this node should be applied to. Context information used during the current parsing process. This structure maps s to the clauses created from them. Implementers that also implement (such as or ) must add their clauses to the mapping in in order to be able to implement correctly. The modified or a new that reflects the changes made by this node. For objects, which mark the end of an chain, this method must not be called. Instead, use to generate a and instantiate a new with that clause. Gets the source that streams data into this node. The source , or if this node is the end of the chain. Gets the identifier associated with this . tries to find the identifier that was originally associated with this node in the query written by the user by analyzing the parameter names of the next expression in the method call chain. The associated identifier. Wraps the into a subquery after a node that indicates the end of the query ( or ). Override this method when implementing a that does not need a subquery to be created if it occurs after the query end. When an ordinary node follows a result operator or group node, it cannot simply append its clauses to the because semantically, the result operator (or grouping) must be executed _before_ the clause. Therefore, in such scenarios, we wrap the current query model into a that we put into the of a new . This method also changes the of this node because logically, all operations must be handled by the new holding the . For example, consider the following call chain: MainSource (...) .Select (x => x) .Distinct () .Select (x => x) Naively, the last Select node would resolve (via Distinct and Select) to the created by the initial MainSource. After this method is executed, however, that is part of the sub query, and a new has been created to hold it. Therefore, we replace the chain as follows: MainSource (MainSource (...).Select (x => x).Distinct ()) .Select (x => x) Now, the last Select node resolves to the new . Sets the result type override of the given . The query model to set the of. By default, the result type override is set to in the method. This ensures that the query model represents the type of the query correctly. Specific node parsers can override this method to set the to another value, or to clear it (set it to ). Do not leave the unchanged when overriding this method, as a source node might have set it to a value that doesn't fit this node. Represents a for the , , , and methods. It is generated by when an tree is parsed. When this node is used, it marks the beginning (i.e. the last node) of an chain that represents a query. Represents a for the and methods. It is generated by when an tree is parsed. When this node is used, it marks the beginning (i.e. the last node) of an chain that represents a query. Represents a for the , , , and methods. It is generated by when an tree is parsed. When this node is used, it marks the beginning (i.e. the last node) of an chain that represents a query. Represents a for the different overloads of . It is generated by when an tree is parsed. When this node is used, it marks the beginning (i.e. the last node) of an chain that represents a query. Represents a for . It is generated by when an tree is parsed. Encapsulates contextual information used while generating clauses from instances. Represents a for . It is generated by when an tree is parsed. When this node is used, it usually follows (or replaces) a of an chain that represents a query. Acts as a base class for and , i.e., for node parsers for set operations acting as an . Interface for classes representing query source parts of an tree. Represents a for and . It is generated by when an tree is parsed. When this node is used, it marks the beginning (i.e. the last node) of an chain that represents a query. Represents a for , , for the Count properties of , , , and , and for the property of arrays. It is generated by when an tree is parsed. When this node is used, it marks the beginning (i.e. the last node) of an chain that represents a query. Represents a for and and and It is generated by when an tree is parsed. When this node is used, it usually follows (or replaces) a of an chain that represents a query. Represents a for . It is generated by when an tree is parsed. When this node is used, it usually follows (or replaces) a of an chain that represents a query. Represents a for . It is generated by when an tree is parsed. When this node is used, it usually follows (or replaces) a of an chain that represents a query. Thrown whan an parser cannot be instantiated for a query. Note that this is not serializable and intended to be caught in the call-site where it will then replaced by a different (serializable) exception. Resolves an expression using , removing transparent identifiers and detecting subqueries in the process. This is used by methods such as , which are used when a clause is created from an . Represents a for , , or . It is generated by when an tree is parsed. When this node is used, it marks the beginning (i.e. the last node) of an chain that represents a query. Represents a for the different overloads that do not take a result selector. The overloads with a result selector are represented by . It is generated by when an tree is parsed. Represents a for the different overloads that do take a result selector. The overloads without a result selector are represented by . It is generated by when an tree is parsed. The GroupBy overloads with result selector are parsed as if they were a following a : x.GroupBy (k => key, e => element, (k, g) => result) is therefore equivalent to: c.GroupBy (k => key, e => element).Select (grouping => resultSub) where resultSub is the same as result with k and g substituted with grouping.Key and grouping, respectively. Represents a for or It is generated by when an tree is parsed. Represents a for . It is generated by when an tree is parsed. When this node is used, it usually follows (or replaces) a of an chain that represents a query. Represents a for or . It is generated by when an tree is parsed. Represents a for , , or . It is generated by when an tree is parsed. When this node is used, it marks the beginning (i.e. the last node) of an chain that represents a query. Represents a for , , and for the property of arrays. It is generated by when an tree is parsed. When this node is used, it marks the beginning (i.e. the last node) of an chain that represents a query. Represents the first expression in a LINQ query, which acts as the main query source. It is generated by when an tree is parsed. This node usually marks the end (i.e. the first node) of an chain that represents a query. Represents a for or . It is generated by when an tree is parsed. When this node is used, it marks the beginning (i.e. the last node) of an chain that represents a query. Creates instances of classes implementing the interface via Reflection. The classes implementing instantiated by this factory must implement a single constructor. The source and constructor parameters handed to the method are passed on to the constructor; for each argument where no parameter is passed, is passed to the constructor. Creates an instace of type . Thrown if the or the do not match expected constructor parameters of the . Contains metadata about a that is parsed into a . Gets the associated identifier, i.e. the name the user gave the data streaming out of this expression. For example, the corresponding to a from c in C clause should get the identifier "c". If there is no user-defined identifier (or the identifier is impossible to infer from the expression tree), a generated identifier is given instead. Gets the source expression node, i.e. the node streaming data into the parsed node. The source. Gets the being parsed. Represents a for or . It is generated by when an tree is parsed. When this node is used, it marks the beginning (i.e. the last node) of an chain that represents a query. Represents a for and . It is generated by when an tree is parsed. Represents a for . It is generated by when an tree is parsed. Represents a for . It is generated by when an tree is parsed. Provides common functionality used by implementors of . Replaces the given parameter with a back-reference to the corresponding to . The referenced node. The parameter to replace with a . The expression in which to replace the parameter. The clause generation context. , with replaced with a pointing to the clause corresponding to . Gets the corresponding to the given , throwing an if no such clause has been registered in the given . The node for which the should be returned. The clause generation context. The corresponding to . Caches a resolved expression in the classes. Represents a for . It is generated by when an tree is parsed. When this node is used, it usually follows (or replaces) a of an chain that represents a query. Represents a for . It is generated by when an tree is parsed. Represents a for . It is generated by when an tree is parsed. This node represents an additional query source introduced to the query. Represents a for , , or . It is generated by when an tree is parsed. When this node is used, it marks the beginning (i.e. the last node) of an chain that represents a query. Represents a for It is generated by when an tree is parsed. When this node is used, it usually follows (or replaces) a of an chain that represents a query. Represents a for the different overloads of . It is generated by when an tree is parsed. When this node is used, it marks the beginning (i.e. the last node) of an chain that represents a query. Represents a for . It is generated by when an tree is parsed. When this node is used, it usually follows (or replaces) a of an chain that represents a query. Represents a for . It is generated by when an tree is parsed. When this node is used, it follows an , an , a , or a . Represents a for . It is generated by when an tree is parsed. When this node is used, it follows an , an , a , or a . Represents a for . It is generated by when an tree is parsed. When this node is used, it usually follows (or replaces) a of an chain that represents a query. Represents a for . It is generated by when an tree is parsed. is implemented by classes taking an tree and parsing it into a . The default implementation of this interface is . LINQ providers can, however, implement themselves, eg. in order to decorate or replace the functionality of . Gets the of the given . The expression tree to parse. A that represents the query defined in . Parses a and creates an from it. This is used by for parsing whole expression trees. Implements by storing a list of inner instances. The and methods delegate to these inner instances. This is an implementation of the Composite Pattern. Maps the objects used in objects to the respective types. This is used by when a is encountered to instantiate the right for the given method. Creates a and registers all relevant implementations in the Remotion.Linq assembly. A with all types in the Remotion.Linq assembly registered. Gets the registerable method definition from a given . A registerable method is a object that can be registered via a call to . When the given is passed to and its corresponding registerable method was registered, the correct node type is returned. The method for which the registerable method should be retrieved. Must not be . to throw a if the method cannot be matched to a distinct generic method definition, to return if an unambiguous match is not possible. itself, unless it is a closed generic method or declared in a closed generic type. In the latter cases, the corresponding generic method definition respectively the method declared in a generic type definition is returned. If no generic method definition could be matched and was set to , is returned. Thrown if is set to and no distinct generic method definition could be resolved. Registers the specific with the given . The given methods must either be non-generic or open generic method definitions. If a method has already been registered before, the later registration overwrites the earlier one. Determines whether the specified method was registered with this . Gets the type of registered with this instance that matches the given , returning if none can be found. Returns the count of the registered s. Maps the objects used in objects to the respective types based on the method names and a filter (as defined by ). This is used by when a is encountered to instantiate the right for the given method. Creates a and registers all relevant implementations in the Remotion.Linq assembly. A with all types in the Remotion.Linq assembly registered. Registers the given for the query operator methods defined by the given objects. A sequence of objects defining the methods to register the node type for. The type of the to register. Determines whether the specified method was registered with this . Gets the type of registered with this instance that matches the given , returning if none can be found. Returns the count of the registered method names. Defines a name and a filter predicate used when determining the matching expression node type by . Takes an tree and parses it into a by use of an . It first transforms the tree into a chain of instances, and then calls and in order to instantiate all the s. With those, a is created and returned. Initializes a new instance of the class, using default parameters for parsing. The used has all relevant methods of the class automatically registered, and the comprises partial evaluation, and default expression transformations. See , , and for details. Initializes a new instance of the class, using the given to convert instances into s. Use this constructor if you wish to customize the parser. To use a default parser (with the possibility to register custom node types), use the method. The expression tree parser. Gets the of the given . The expression tree to parse. A that represents the query defined in . Applies all nodes to a , which is created by the trailing in the chain. The entry point to the chain. The clause generation context collecting context information during the parsing process. A created by the training and transformed by each node in the chain. Gets the used by to parse instances. The node type registry. Gets the used by to process the tree before analyzing its structure. The processor. Implements an that throws an exception for every expression type that is not explicitly supported. Inherit from this class to ensure that an exception is thrown when an expression is passed Called when an unhandled item is visited. This method provides the item the visitor cannot handle (), the that is not implemented in the visitor, and a delegate that can be used to invoke the of the class. The default behavior of this method is to call the method, but it can be overridden to do something else. The type of the item that could not be handled. Either an type, a type, or . The result type expected for the visited . The unhandled item. The visit method that is not implemented. The behavior exposed by for this item type. An object to replace in the expression tree. Alternatively, the method can throw any exception. can be used to build tuples incorporating a sequence of s. For example, given three expressions, exp1, exp2, and exp3, it will build nested s that are equivalent to the following: new KeyValuePair(exp1, new KeyValuePair(exp2, exp3)). Given an whose type matches that of a tuple built by , the builder can also return an enumeration of accessor expressions that can be used to access the tuple elements in the same order as they were put into the nested tuple expression. In above example, this would yield tupleExpression.Key, tupleExpression.Value.Key, and tupleExpression.Value.Value. This class can be handy whenever a set of needs to be put into a single (eg., a select projection), especially if each sub-expression needs to be explicitly accessed at a later point of time (eg., to retrieve the items from a statement surrounding a sub-statement yielding the tuple in its select projection). Acts as a common base class for implementations based on re-linq. In a specific LINQ provider, a custom queryable class should be derived from which supplies an implementation of that is used to execute the query. This is then used as an entry point (the main data source) of a LINQ query. The type of the result items yielded by this query. Initializes a new instance of the class with a and the given . This constructor should be used by subclasses to begin a new query. The generated by this constructor is a pointing back to this . The used to parse queries. Specify an instance of for default behavior. See also . The used to execute the query represented by this . Initializes a new instance of the class with a specific . This constructor should only be used to begin a query when does not fit the requirements. The provider used to execute the query represented by this and to construct queries around this . Initializes a new instance of the class with a given and . This is an infrastructure constructor that must be exposed on subclasses because it is used by to construct queries around this when a query method (e.g. of the class) is called. The provider used to execute the query represented by this and to construct queries around this . The expression representing the query. Executes the query via the and returns an enumerator that iterates through the items returned by the query. A that can be used to iterate through the query result. Gets the expression tree that is associated with the instance of . This expression describes the query represented by this . The that is associated with this instance of . Gets the query provider that is associated with this data source. The provider is used to execute the query. By default, a is used that parses the query and passes it on to an implementation of . The that is associated with this data source. Gets the type of the element(s) that are returned when the expression tree associated with this instance of is executed. A that represents the type of the element(s) that are returned when the expression tree associated with this object is executed. Provides an abstraction of an expression tree created for a LINQ query. instances are passed to LINQ providers based on re-linq via , but you can also use to parse an expression tree by hand or construct a manually via its constructor. The different parts of the query are mapped to clauses, see , , and . The simplest way to process all the clauses belonging to a is by implementing (or deriving from ) and calling . Initializes a new instance of The of the query. This is the starting point of the query, generating items that are filtered and projected by the query. The of the query. This is the end point of the query, it defines what is actually returned for each of the items coming from the and passing the . After it, only the modify the result of the query. Gets an object describing the data streaming out of this . If a query ends with the , this corresponds to . If a query has , the data is further modified by those operators. Gets a object describing the data streaming out of this . The data streamed from a is often of type instantiated with a specific item type, unless the query ends with a . For example, if the query ends with a , the result type will be . The is not compatible with the calculated calculated from the . Gets the which is used by the . Accepts an implementation of or , as defined by the Visitor pattern. Returns a representation of this . Clones this , returning a new equivalent to this instance, but with its clauses being clones of this instance's clauses. Any in the cloned clauses that points back to another clause in this (including its subqueries) is adjusted to point to the respective clones in the cloned . Any subquery nested in the is also cloned. Clones this , returning a new equivalent to this instance, but with its clauses being clones of this instance's clauses. Any in the cloned clauses that points back to another clause in this (including its subqueries) is adjusted to point to the respective clones in the cloned . Any subquery nested in the is also cloned. The defining how to adjust instances of in the cloned . If there is a that points out of the being cloned, specify its replacement via this parameter. At the end of the cloning process, this object maps all the clauses in this original to the clones created in the process. Transforms all the expressions in this 's clauses via the given delegate. The transformation object. This delegate is called for each within this , and those expressions will be replaced with what the delegate returns. Returns a new name with the given prefix. The name is different from that of any added in the . Note that clause names that are changed after the clause is added as well as names of other clauses than from clauses are not considered when determining "unique" names. Use names only for readability and debugging, not for uniquely identifying clauses. Executes this via the given . By default, this indirectly calls , but this can be modified by the . The to use for executing this query. Determines whether this represents an identity query. An identity query is a query without any body clauses whose selects exactly the items produced by its . An identity query can have . if this represents an identity query; otherwise, . An example for an identity query is the subquery in that is produced for the in the following query: from order in ... select order.OrderItems.Count() In this query, the will become a because is treated as a query operator. The in that has no and a trivial , so its method returns . The outer , on the other hand, does not have a trivial , so its method returns . Creates a new that has this as a sub-query in its . The name of the new 's . A new whose 's is a that holds this instance. Gets or sets the query's . This is the starting point of the query, generating items that are processed by the and projected or grouped by the . Gets or sets the query's select clause. This is the end point of the query, it defines what is actually returned for each of the items coming from the and passing the . After it, only the modify the result of the query. Gets a collection representing the query's body clauses. Body clauses take the items generated by the , filtering (), ordering (), augmenting (), or otherwise processing them before they are passed to the . Gets the result operators attached to this . Result operators modify the query's result set, aggregating, filtering, or otherwise processing the result before it is returned. Collects clauses and creates a from them. This provides a simple way to first add all the clauses and then create the rather than the two-step approach (first and , then the s) required by 's constructor. Provides a default implementation of which automatically visits child items. That is, the default implementation of automatically calls Accept on all clauses in the and the default implementation of automatically calls on the instances in its collection, and so on. This visitor is hardened against modifications performed on the visited while the model is currently being visited. That is, if a the collection changes while a body clause (or a child item of a body clause) is currently being processed, the visitor will handle that gracefully. The same applies to and . Takes a and transforms it by replacing its instances ( and ) that contain subqueries with equivalent flattened clauses. Subqueries that contain a (such as or ) cannot be flattened. As an example, take the following query: from c in Customers from o in (from oi in OrderInfos where oi.Customer == c orderby oi.OrderDate select oi.Order) orderby o.Product.Name select new { c, o } This will be transformed into: from c in Customers from oi in OrderInfos where oi.Customer == c orderby oi.OrderDate orderby oi.Order.Product.Name select new { c, oi.Order } As another example, take the following query: from c in (from o in Orders select o.Customer) where c.Name.StartsWith ("Miller") select c (This query is never produced by the , the only way to construct it is via manually building a .) This will be transforemd into: from o in Orders where o.Customer.Name.StartsWith ("Miller") select o Generates unique identifiers based on a set of known identifiers. An identifier is generated by appending a number to a given prefix. The identifier is considered unique when no known identifier exists which equals the prefix/number combination. Adds the given to the set of known identifiers. The identifier to add. Gets a unique identifier starting with the given . The identifier is generating by appending a number to the prefix so that the resulting string does not match a known identifier. The prefix to use for the identifier. A unique identifier starting with . Provides extensions for working with trees. Builds a string from the tree, including .NET 3.5. Provider a utility API for dealing with the item type of generic collections. Tries to extract the item type from the input . The that might be an implementation of the interface. Must not be . An output parameter containing the extracted item or . if an could be extracted, otherwise .