Skip to main content
Filter by
Sorted by
Tagged with
6 votes
2 answers
1k views

So I've been tinkering with Linq.Expressions (and if anyone can suggest a more proper or more elegant way to do what I'm doing please feel free to chime in) and have hit a wall in trying to do ...
David's user avatar
  • 1,861
0 votes
4 answers
1k views

I am writing a re-usable view for my app. It uses a generic ViewModel DynSingleView<T>; you plug in the object type and the view will generate the property UI components to update them. It gets ...
Daniel's user avatar
  • 1,857
1 vote
0 answers
369 views

This is very similar to this answer however, I don't have type information at build time. I have Type variable. How would I cast LambdaExpression to Expression<Func<T,bool>> where T is ...
user21479's user avatar
  • 1,189
1 vote
1 answer
206 views

I have a grid with (n) dynamically generated columns. One of the requirements is that a row only be shown in the grid if a non-null/non-zero value exists in one of the shown columns. I am using an ...
dev30207's user avatar
  • 537
1 vote
2 answers
389 views

I'm trying to create an extension method to do this: enum AlphaBet { A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z } IEnumerable<AlphaBet> rangeCtoG = AlphaBet.C.RangeToInc(AlphaBet.G); ...
Tar's user avatar
  • 9,125
2 votes
1 answer
60 views

When I write expressions in our application as lambda expressions, I can usually make use of the following construct1: dbContext.Contents<MyEntity>() (dbContext is of a custom class.) Somehow, ...
O. R. Mapper's user avatar
  • 20.9k
0 votes
1 answer
435 views

I have a scenario where I have 3 Entities class entityA { public Guid Id { get; set; } public string NameA { get; set; } } class entityB { public Guid Id { get; set; } public string ...
Developerzzz's user avatar
  • 1,126
5 votes
1 answer
998 views

TL;DR How do you create an Expression where Expression.NodeType == ExpresionType.IsTrue || ExpresionType.IsFalse Background Info I am creating a custom version of EnumerableQuery, where I rewrite ...
Michal Ciechan's user avatar
3 votes
1 answer
3k views

Based on some user input, I dynamically compose an Expression. Now, I need to distinguish the case where this expression is writable from the case where it's not. An example of a writable expression ...
Dejan's user avatar
  • 10.5k
2 votes
0 answers
191 views

I have an Expression.Call which uses Expression.Parameter(typeof(Type)) to return an instance of type SomeType, which is in fact a derived class SomeType<T> with a field SomeField of type T ...
user487779's user avatar
1 vote
1 answer
173 views

I'm using Entity Framework 6. I have 2 classes: public class BookingRecord { public int Id {get; set;} public int CustomerId {get; set;} [ForeignKey("CustomerId")] public virtual ...
Farrah Jiang's user avatar
0 votes
1 answer
154 views

I have class DropdownFilter which has: private readonly Func<TEntity, string> fieldWhichMustEqualValue; public override IQueryable<TEntity> Filter(IQueryable<TEntity> ...
hyankov's user avatar
  • 4,136
2 votes
1 answer
155 views

This is a follow up to my question Dynamic Expression Generation Issues with ValueTypes adding in a new variable: Entity Framework. Now that I am able to generate the necessary Expressions when ...
JNYRanger's user avatar
  • 7,117
0 votes
1 answer
316 views

I'm trying to write a method that would take an object with property name as a lambda parameter, and use it on passed object, but also use it on another, new object of the same type created inside ...
Rob.Ak's user avatar
  • 237
-1 votes
2 answers
252 views

I am having two lists and filter based on a group of values. var UserIdList = response.Users.Select(p => p.Id).ToList(); var filteredRecords = (from o in om.Organizations join u in om.Users on ...
AMDI's user avatar
  • 1,001
1 vote
1 answer
2k views

I have followed several threads on SO and other websites and am still having difficulty. I have the following code: public static IQueryable<TSource> Between<TSource, TKey>(this ...
gilesrpa's user avatar
  • 1,071
8 votes
0 answers
451 views

Looking at the documented overloads available for the Expression.Call(), method, I can find the following overloads to obtain an expression node that will perform a call to an instance method ...
BlueStrat's user avatar
  • 2,324
3 votes
1 answer
2k views

How can I combine/join/chain two Expressions into one? E.g Expression<Func<A,object>> first = x => x.B.C; Expression<Func<C,object>> second = x => x.D.E; Where the end ...
Vincent's user avatar
  • 1,161
2 votes
0 answers
1k views

Given an input of two expressions, e.g.: Expression<Func<Customer,string>> nameExpression = x=>x.Name; Expression<Func<Customer,string>> nameExpression = x=>x....
Michiel Cornille's user avatar
0 votes
2 answers
2k views

How to convert : Expression<Func<T, object>> to Expression<Func<object>>? For example: public class Entity { public virtual long Id { get; set; } } Origin: ...
Roman Koliada's user avatar
-1 votes
1 answer
111 views

I'm looking for a library/tool in order to be able to de/serialize Linq Expressions. Is there some library over there? Is already suported natively on .Net? How could I get an starter stuff code?
Jordi's user avatar
  • 23.6k
4 votes
0 answers
51 views

Suppose I have two classes that look like this: public class Foo { public ICollection<Bar> Bars { get; set; } public static Expression<Func<Foo, Bar>> GetNewestBar() { ...
joelmdev's user avatar
  • 11.9k
0 votes
1 answer
56 views

Consider the following code example, modelling base and sub-classes: class Entity { } class Dough : Entity { } class Bread : Entity { IEnumerable<Dough> TypesOfDough { get; set; } } ...
Matthew Layton's user avatar
0 votes
1 answer
191 views

I am new to Linq Expressions. I am calling an API, that exposes the following overloaded methods: CustomPaging<TEntity> GetAll(int index, int maxPage, Expression<Func<TEntity, int>&...
Peter's user avatar
  • 5,330
3 votes
1 answer
3k views

I'd like to generate this sentence using Expression trees: o?.Value o is an instance of whichever class. Is there some way?
Jordi's user avatar
  • 23.6k

1
3 4
5
6 7
13