The compiler usually chokes when an event doesn't appear beside a ...+=... or a ...-=..., so I'm not sure if this is possible....I want to be able to identify an event by using an Expression tree, so I can create an event watcher for a test. The syntax wo...
I have an IQueryable and an object of type T....I want to do IQueryable().Where(o => o.GetProperty(fieldName) == objectOfTypeT.GetProperty(fieldName))...so ......public IQueryable<T> DoWork<T>(string fieldName)
where T : EntityObject
{
...
T...
public static IQueryable<TResult> ApplySortFilter<T, TResult>(this IQueryable<T> query, string columnName)
where T : EntityObject
{
var param = Expression.Parameter(typeof(T), "o");
var body = Expression.PropertyOrField(param,columnName);
var sor...
I am trying to create an expression tree that represents the following:...myObject.childObjectCollection.Any(i => i.Name == "name");
...Shortened for clarity, I have the following:...//'myObject.childObjectCollection' is represented here by 'propertyExp'
...
I am looking to create an expression tree by parsing xml using C#.
The xml would be like the following:...<Expression>
<If>
<Condition>
<GreaterThan>
<X>
<Y>
</GreaterThan>
</Condition>
<Expression />
<If>
<Else>
<Expression />...
What is the best way to call an instance method within an Expression Tree? My current solution is something like this for an interface method "object GetRowValue(rowIndex)" of the interface IColumn....public static Expression CreateGetRowValueExpression(
...
I am trying to write a static function to Or two expressions, but recieve the following error:...The parameter 'item' is not in scope....Description: An unhandled exception
occurred during the execution of the
current web request. Please review the
...
Is it possible to pass parts of a linq Query into a function?
I want create a common interface for my DAL that always uses the same query interface. For example, ...List<T> Get(Join j, Where w, Select s){
return currentDataContext<T>.Join(j).Wh...
I would like to generate the following select statement dynamically using expression trees:...var v = from c in Countries
where c.City == "London"
select new {c.Name, c.Population};
...I have worked out how to generate...var v = from c in ...
I am the dummy in this scenario....I've tried to read on Google what these are but I just don't get it. Can someone give me a simple explanation of what they are and why they're useful?...edit: I'm talking about the LINQ feature in .Net.
Is there a better way to get the Property name when passed in via a lambda expression?
Here is what i currently have....eg. ...GetSortingInfo<User>(u => u.UserId);
...It worked by casting it as a memberexpression only when the property was a string. beca...
since i am using POCOS in my domain, i want my repository to be able to received Expression filters of the type of my POCOS and change the parameter in the expression to be the of type of my LINQ tables, my fields have the same name as my members so i was...
I have a Linq provider that sucessfully goes and gets data from my chosen datasource, but what I would like to do now that I have my filtered resultset, is allow Linq to Objects to process the rest of the Expression tree (for things like Joins, projection...
The ...dynamic language runtime (DLR)... has some pretty cool code for Expression's, including some very nice code to print out Expression trees which I want to use so that:...int a = 1;
int b = 2;
Expression<Func<int, int>> expression = (c) => a + (b * ...
I have a method that alters an "Account" object based on the action delegate passed into it:...public static void AlterAccount(string AccountID, Action<Account> AccountAction) {
Account someAccount = accountRepository.GetAccount(AccountID);
AccountAct...
How would I go about using an Expression Tree to dynamically create a predicate that looks something like......(p.Length== 5) && (p.SomeOtherProperty == "hello")
...So that I can stick the predicate into a lambda expression like so......q.Where(myDynamic...
Is it possible to somehow programmatically convert a sql query to a linq expression tree? The sql query is supposed to be generated by this linq query, so I'm thinking of it as a poor man's serialization\deserialization of linq queries to t-sql format....
I've been playing around with the ...DLR... a bit and am a bit stuck on calling methods. For example, suppose I want to make an expression to push something onto a stack:...class StackInfo{
protected Stack<SomeClass> _stack;
public Expression P...