linq-expressions Questions

4

Solved

I need to do some filtering on an ObjectSet to obtain the entities I need by doing this : query = this.ObjectSet.Where(x => x.TypeId == 3); // this is just an example; Later in the code (and ...
Bannon asked 26/4, 2013 at 16:0

1

Solved

I'm dynamically building linq queries for nHibernate. Due to dependencies, I wanted to cast/retrieve the typed expression at a later time, but I have been unsuccessfull so far. This is not workin...
Durning asked 25/4, 2013 at 11:1

5

Solved

I try do implement a user dynamic filter, where used selects some properties, selects some operators and selects also the values. As I didn't find yet an answer to this question, I tried to use L...
Butter asked 16/8, 2011 at 10:54

2

We're having some issues implementing soft delete functionality with entity framework. The idea is to use a repository which is aware of the EF context. On the level of the repository we implemente...

3

Solved

I seem to be having trouble executing a lambda expression that I've previously assigned to a variable. Here's a small C# example program I've put together: public class Program { public static voi...
Aimeeaimil asked 1/2, 2013 at 21:51

2

Solved

I'm trying to write a method that finds all types in an assembly with a specific custom attribute. I also need to be able to supply a string value to match on. The caveat is that I would like to be...
Doddering asked 21/1, 2013 at 17:2

3

I've got some code that generates various Func<> delegates using System.Linq.Expressions and Expression.Lambda<Func<>>.Compile() etc. I would like to be able to serialize the gene...
Kraemer asked 26/2, 2010 at 22:18

2

Solved

Is there a way to build Expression<Func<T,bool>> from Expression<Func<T>>? For example for class public class MyClass { public int Prop1{get;set;} public int Prop2{get;s...
Broderick asked 7/12, 2012 at 7:11

2

Solved

I'm trying to use predicates in my EF filtering code. This works: IQueryable<Customer> filtered = customers.Where(x => x.HasMoney && x.WantsProduct); But this: Predicate<T&...
Solomonsolon asked 15/11, 2012 at 1:9

3

Solved

Using the following example i would like to use my Expression inside my Contains method, having it pass the query onto sql server using the EF. How can i build this up to work correctly? void Mai...
Analogue asked 10/4, 2012 at 14:1

1

Solved

I'm building a C# expression-to-Javascript converter, along the lines of Linq-to-SQL, but I'm running into problems with compiler generated expression trees. The particular problem I'm having is d...
Lizzielizzy asked 13/6, 2012 at 4:14

1

Solved

I have a simple custom QueryProvider that takes an expression, translates it to SQL and queries an sql database. I want to create a small cache in the QueryProvider that stores commonly accessed o...
Embroidery asked 22/5, 2012 at 14:23

1

Solved

I'm trying to use GetCustomAttributes() to get an attribute defined on a property. The issue is that the property is an overridden one and I can't work out how to extract the overridden one from th...
Incompletion asked 25/4, 2012 at 22:40

1

Solved

I am trying to build an expression tree programmatically. I have in my input, a list of condition classes which have the following form: public class Filter { public string field { get; set; } ...

1

Solved

I wrote an HtmlHelper expression I use a lot of the time to put title tags into my dropdown lists like so: public static HtmlString SelectFor<TModel, TProperty, TListItem>( this HtmlHelper...
Semantic asked 29/10, 2011 at 2:19

1

Solved

I have a predicate Expression<Func<T1, bool>> I need to use it as a predicate Expression<Func<T2, bool>> using the T1 property of T2 I was trying to think about several app...
Trapp asked 2/10, 2011 at 14:31

3

Solved

How should I construct Expression tree for string.IndexOf("substring", StringComparison.OrdinalIgnoreCase)? I can get it working without the second argument: StringComparison.OrdinalIgnoreCase. Th...
Fulgor asked 17/8, 2011 at 7:27

1

Solved

Hello, I am using LINQ and EF with C# 4.0. I have dragged the basic ELMAH table into EF (built and saved many many times). All is working as one would expect. But have tried to be too ambitious a...
Semiliterate asked 7/6, 2011 at 18:20

2

Solved

I'm trying to call String.Format from with in a Linq.Expression tree. Here's a quick example: var format = Expression.Constant("({0}) {1}"); var company = Expression.Property(input, membernames....
Akeyla asked 24/5, 2011 at 22:1

2

Solved

If I've got a LINQ expression of the form: Expression<Func<MyClass, string, bool>> filterExpression = (x, filterVal) => x.DisplayName.Contains(filterVal); Is there any way I can g...
Vinna asked 16/5, 2011 at 2:29

1

Solved

I don't understand what is happening here: Both of these lines compile: Func<object> func = () => new object(); Expression<Func<object>> expression = ()=>new object(); ...
Hobbyhorse asked 2/5, 2011 at 20:45

1

Solved

I want to combine two LambdaExpressions without compiling them. This is what it looks like if I do compile them: public Expression<Func<TContainer,bool>> CreatePredicate<TContaine...
Propagate asked 19/3, 2011 at 12:7

2

Solved

Typically my repositories have logging statements for debugging purposes, allowing me to see values of parameters. Recently I went down the path of creating a generic repository that take predicate...
Aiello asked 3/3, 2011 at 17:32

3

Solved

I am considering using a Linq Expression as a key in a dictionary. However, I am concerned that I will get strange results, because I don't know how Equality is determined by Linq expressions. Do...
Malony asked 17/2, 2011 at 18:14

1

Solved

I have a class named Product in class library project. I am using SubSonic SimpleRepository to persist objects. I have a method as follows in Product class: public static IList<Product> Load...
Hettiehetty asked 12/1, 2011 at 19:45

© 2022 - 2024 — McMap. All rights reserved.