public static IQueryable <TTarget> Build <TSource, TTarget>(IQueryable <TSource> source, ModelConvertOptions options) { if (options == null) { options = ModelConvert.Target <TTarget>().Source <TSource>().Options.IgnoreReadOnly(); } options.IgnoreReadOnly(); MemberBindingState state = new MemberBindingState(Expression.Parameter(typeof(TSource), "obj")); ModelConvert.WalkConvertiblProperties(null, ModelInfo.GetModelInfo(typeof(TTarget)), null, ModelInfo.GetModelInfo(typeof(TSource)), options, BuildProperty, state); var body = Expression.MemberInit(Expression.New(typeof(TTarget)), state.Bindings); var lambda = Expression.Lambda <Func <TSource, TTarget> >(body, state.Parameter); return(source.Select(lambda)); }