public static IQueryable ApplySelect(IQueryable source, Type elementType, SelectClause selectClause) { var propSigs = selectClause.Properties; var dti = DynamicTypeInfo.FindOrCreate(propSigs.Select(ps => ps.Name), propSigs.Select(ps => ps.ReturnType)); var lambdaExpr = CreateNewLambda(dti, propSigs); var method = TypeFns.GetMethodByExample((IQueryable <String> q) => q.Select(s => s.Length), elementType, dti.DynamicType); var func = BuildIQueryableFunc(elementType, method, lambdaExpr); return(func(source)); }
public void Create1() { var propNames = new string[] { "LastName", "FirstName", "Age" }; var propTypes = new Type[] { typeof(String), typeof(String), typeof(Int32) }; var t1 = DynamicTypeInfo.FindOrCreate(propNames, propTypes); var t2 = DynamicTypeInfo.FindOrCreate(propNames, propTypes); Assert.IsTrue(t1 == t2); }