Linq Dynamic query for getting dynamic list based on Id

vinoth vinoth

vinoth vinoth

Dec 6 2017 1:13 AM
I have created the Dynamic Model list.Here i need to get Dynamic list based on id.so I have tried the code. but i didn't get correct result.please help to get that
public virtual List<TModel> GetAll(long index=0,string FieldName="")
catch (Exception exc)
IsError = true;
ErrorMessage = exc.ToString();
Status = "Sorry,Not taken the Details";
return null;
public static IQueryable<V> SelectByName<T,V>(this IQueryable<T> source,
string FieldName)
ParameterExpression paramExp = Expression.Parameter(typeof(T), "x");
ConstantExpression valueexp = Expression.Constant(value);
MemberExpression memberExp = Expression.PropertyOrField(paramExp, FieldName);
var lambdaExp = Expression.Lambda<Func<T, V>>(memberExp, paramExp);
return source.Select(lambdaExp);

Upload Source Code:  Select only zip and rar file.

Answers (1)