@@ -30,6 +30,17 @@ public static LambdaExpression ParseLambda([CanBeNull] ParsingConfig parsingConf
30
30
return Expression . Lambda ( parser . Parse ( resultType , createParameterCtor ) ) ;
31
31
}
32
32
33
+ // NEED TEXT!
34
+ [ PublicAPI ]
35
+ public static LambdaExpression ParseLambda ( [ CanBeNull ] Type delegateType , [ CanBeNull ] ParsingConfig parsingConfig , bool createParameterCtor , [ CanBeNull ] Type resultType , [ NotNull ] string expression , params object [ ] values )
36
+ {
37
+ Check . NotEmpty ( expression , nameof ( expression ) ) ;
38
+
39
+ var parser = new ExpressionParser ( new ParameterExpression [ 0 ] , expression , values , parsingConfig ) ;
40
+
41
+ return Expression . Lambda ( delegateType , parser . Parse ( resultType , createParameterCtor ) ) ;
42
+ }
43
+
33
44
/// <summary>
34
45
/// Parses an expression into a Typed Expression.
35
46
/// </summary>
@@ -45,6 +56,12 @@ public static Expression<Func<TResult>> ParseLambda<TResult>([CanBeNull] Parsing
45
56
return ( Expression < Func < TResult > > ) ParseLambda ( parsingConfig , createParameterCtor , typeof ( TResult ) , expression , values ) ;
46
57
}
47
58
59
+ [ PublicAPI ]
60
+ public static Expression < Func < TResult > > ParseLambda < TResult > ( [ CanBeNull ] Type delegateType , [ CanBeNull ] ParsingConfig parsingConfig , bool createParameterCtor , [ NotNull ] string expression , params object [ ] values )
61
+ {
62
+ return ( Expression < Func < TResult > > ) ParseLambda ( delegateType , parsingConfig , createParameterCtor , typeof ( TResult ) , expression , values ) ;
63
+ }
64
+
48
65
/// <summary>
49
66
/// Parses an expression into a LambdaExpression.
50
67
/// </summary>
@@ -57,7 +74,16 @@ public static Expression<Func<TResult>> ParseLambda<TResult>([CanBeNull] Parsing
57
74
/// <returns>The generated <see cref="LambdaExpression"/></returns>
58
75
[ PublicAPI ]
59
76
public static LambdaExpression ParseLambda ( [ CanBeNull ] ParsingConfig parsingConfig , bool createParameterCtor , [ NotNull ] ParameterExpression [ ] parameters , [ CanBeNull ] Type resultType , [ NotNull ] string expression , params object [ ] values )
77
+ {
78
+ return ParseLambda ( parsingConfig , createParameterCtor , parameters , resultType , null , expression , values ) ;
79
+ }
80
+
81
+ // NEED TEXT!
82
+ [ PublicAPI ]
83
+ public static LambdaExpression ParseLambda ( [ CanBeNull ] Type delegateType , [ CanBeNull ] ParsingConfig parsingConfig , bool createParameterCtor , [ NotNull ] ParameterExpression [ ] parameters , [ CanBeNull ] Type resultType , [ NotNull ] string expression , params object [ ] values )
60
84
{
85
+ LambdaExpression lambdaExpression = null ;
86
+
61
87
Check . NotNull ( parameters , nameof ( parameters ) ) ;
62
88
Check . HasNoNulls ( parameters , nameof ( parameters ) ) ;
63
89
Check . NotEmpty ( expression , nameof ( expression ) ) ;
@@ -71,12 +97,28 @@ public static LambdaExpression ParseLambda([CanBeNull] ParsingConfig parsingConf
71
97
var renamer = new ParameterExpressionRenamer ( parser . LastLambdaItName ) ;
72
98
parsedExpression = renamer . Rename ( parsedExpression , out ParameterExpression newParameterExpression ) ;
73
99
74
- return Expression . Lambda ( parsedExpression , new [ ] { newParameterExpression } ) ;
100
+ if ( delegateType == null )
101
+ {
102
+ lambdaExpression = Expression . Lambda ( parsedExpression , new [ ] { newParameterExpression } ) ;
103
+ }
104
+ else
105
+ {
106
+ lambdaExpression = Expression . Lambda ( delegateType , parsedExpression , new [ ] { newParameterExpression } ) ;
107
+ }
75
108
}
76
109
else
77
110
{
78
- return Expression . Lambda ( parsedExpression , parameters ) ;
111
+ if ( delegateType == null )
112
+ {
113
+ lambdaExpression = Expression . Lambda ( parsedExpression , parameters ) ;
114
+ }
115
+ else
116
+ {
117
+ lambdaExpression = Expression . Lambda ( delegateType , parsedExpression , parameters ) ;
118
+ }
79
119
}
120
+
121
+ return lambdaExpression ;
80
122
}
81
123
82
124
/// <summary>
@@ -95,6 +137,13 @@ public static Expression<Func<TResult>> ParseLambda<TResult>([CanBeNull] Parsing
95
137
return ( Expression < Func < TResult > > ) ParseLambda ( parsingConfig , createParameterCtor , parameters , typeof ( TResult ) , expression , values ) ;
96
138
}
97
139
140
+ // NEED TEXT!
141
+ [ PublicAPI ]
142
+ public static Expression < Func < TResult > > ParseLambda < TResult > ( [ CanBeNull ] Type delegateType , [ CanBeNull ] ParsingConfig parsingConfig , bool createParameterCtor , [ NotNull ] ParameterExpression [ ] parameters , [ NotNull ] string expression , params object [ ] values )
143
+ {
144
+ return ( Expression < Func < TResult > > ) ParseLambda ( delegateType , parsingConfig , createParameterCtor , parameters , typeof ( TResult ) , expression , values ) ;
145
+ }
146
+
98
147
/// <summary>
99
148
/// Parses an expression into a LambdaExpression.
100
149
/// </summary>
@@ -131,6 +180,25 @@ public static Expression<Func<T, TResult>> ParseLambda<T, TResult>([CanBeNull] P
131
180
return ( Expression < Func < T , TResult > > ) ParseLambda ( parsingConfig , createParameterCtor , new [ ] { ParameterExpressionHelper . CreateParameterExpression ( typeof ( T ) , string . Empty , parsingConfig ? . RenameEmptyParameterExpressionNames ?? false ) } , typeof ( TResult ) , expression , values ) ;
132
181
}
133
182
183
+ // NEED TEXT
184
+
185
+ // COMMENT ---- BEGIN ----
186
+ // COMMENT ---- BEGIN ----
187
+ // COMMENT ---- BEGIN ----
188
+
189
+ // Not sur for this method.
190
+
191
+ // COMMENT ---- END ----
192
+ // COMMENT ---- END ----
193
+ // COMMENT ---- END ----
194
+ [ PublicAPI ]
195
+ public static Expression < Func < T , TResult > > ParseLambda < T , TResult > ( [ CanBeNull ] Type delegateType , [ CanBeNull ] ParsingConfig parsingConfig , bool createParameterCtor , [ NotNull ] string expression , params object [ ] values )
196
+ {
197
+ Check . NotEmpty ( expression , nameof ( expression ) ) ;
198
+
199
+ return ( Expression < Func < T , TResult > > ) ParseLambda ( delegateType , parsingConfig , createParameterCtor , new [ ] { ParameterExpressionHelper . CreateParameterExpression ( typeof ( T ) , string . Empty , parsingConfig ? . RenameEmptyParameterExpressionNames ?? false ) } , typeof ( TResult ) , expression , values ) ;
200
+ }
201
+
134
202
/// <summary>
135
203
/// Parses an expression into a LambdaExpression. (Also create a constructor for all the parameters. Note that this doesn't work for Linq-to-Database entities.)
136
204
/// </summary>
@@ -145,6 +213,13 @@ public static LambdaExpression ParseLambda([CanBeNull] ParsingConfig parsingConf
145
213
return ParseLambda ( parsingConfig , true , resultType , expression , values ) ;
146
214
}
147
215
216
+ // NEED TEXT
217
+ [ PublicAPI ]
218
+ public static LambdaExpression ParseLambda ( [ CanBeNull ] Type delegateType , [ CanBeNull ] ParsingConfig parsingConfig , [ CanBeNull ] Type resultType , [ NotNull ] string expression , params object [ ] values )
219
+ {
220
+ return ParseLambda ( delegateType , parsingConfig , true , resultType , expression , values ) ;
221
+ }
222
+
148
223
/// <summary>
149
224
/// Parses an expression into a LambdaExpression. (Also create a constructor for all the parameters. Note that this doesn't work for Linq-to-Database entities.)
150
225
/// </summary>
@@ -160,6 +235,15 @@ public static LambdaExpression ParseLambda([CanBeNull] Type resultType, [NotNull
160
235
return ParseLambda ( null , true , resultType , expression , values ) ;
161
236
}
162
237
238
+ //// NEED TEXT
239
+ //[PublicAPI]
240
+ //public static LambdaExpression ParseLambda([CanBeNull] Type delegateType, [CanBeNull] Type resultType, [NotNull] string expression, params object[] values)
241
+ //{
242
+ // Check.NotEmpty(expression, nameof(expression));
243
+
244
+ // return ParseLambda(delegateType, null, true, resultType, expression, values);
245
+ //}
246
+
163
247
/// <summary>
164
248
/// Parses an expression into a LambdaExpression. (Also create a constructor for all the parameters. Note that this doesn't work for Linq-to-Database entities.)
165
249
/// </summary>
@@ -189,6 +273,13 @@ public static LambdaExpression ParseLambda([CanBeNull] ParsingConfig parsingConf
189
273
return ParseLambda ( parsingConfig , true , itType , resultType , expression , values ) ;
190
274
}
191
275
276
+ // NEED TEXT!
277
+ [ PublicAPI ]
278
+ public static LambdaExpression ParseLambda ( [ CanBeNull ] Type delegateType , [ CanBeNull ] ParsingConfig parsingConfig , [ NotNull ] Type itType , [ CanBeNull ] Type resultType , string expression , params object [ ] values )
279
+ {
280
+ return ParseLambda ( delegateType , parsingConfig , true , itType , resultType , expression , values ) ;
281
+ }
282
+
192
283
/// <summary>
193
284
/// Parses an expression into a LambdaExpression.
194
285
/// </summary>
@@ -208,6 +299,16 @@ public static LambdaExpression ParseLambda([CanBeNull] ParsingConfig parsingConf
208
299
return ParseLambda ( parsingConfig , createParameterCtor , new [ ] { ParameterExpressionHelper . CreateParameterExpression ( itType , string . Empty , parsingConfig ? . RenameEmptyParameterExpressionNames ?? false ) } , resultType , expression , values ) ;
209
300
}
210
301
302
+ // NEED TEXT!
303
+ [ PublicAPI ]
304
+ public static LambdaExpression ParseLambda ( [ CanBeNull ] Type delegateType , [ CanBeNull ] ParsingConfig parsingConfig , bool createParameterCtor , [ NotNull ] Type itType , [ CanBeNull ] Type resultType , string expression , params object [ ] values )
305
+ {
306
+ Check . NotNull ( itType , nameof ( itType ) ) ;
307
+ Check . NotEmpty ( expression , nameof ( expression ) ) ;
308
+
309
+ return ParseLambda ( parsingConfig , createParameterCtor , new [ ] { ParameterExpressionHelper . CreateParameterExpression ( itType , string . Empty , parsingConfig ? . RenameEmptyParameterExpressionNames ?? false ) } , resultType , expression , values ) ;
310
+ }
311
+
211
312
/// <summary>
212
313
/// Parses an expression into a LambdaExpression. (Also create a constructor for all the parameters. Note that this doesn't work for Linq-to-Database entities.)
213
314
/// </summary>
@@ -222,6 +323,13 @@ public static LambdaExpression ParseLambda([NotNull] ParameterExpression[] param
222
323
return ParseLambda ( null , true , parameters , resultType , expression , values ) ;
223
324
}
224
325
326
+ // NEED TEXT!
327
+ [ PublicAPI ]
328
+ public static LambdaExpression ParseLambda ( [ CanBeNull ] Type delegateType , [ NotNull ] ParameterExpression [ ] parameters , [ CanBeNull ] Type resultType , string expression , params object [ ] values )
329
+ {
330
+ return ParseLambda ( delegateType , null , true , parameters , resultType , expression , values ) ;
331
+ }
332
+
225
333
/// <summary>
226
334
/// Parses an expression into a LambdaExpression. (Also create a constructor for all the parameters. Note that this doesn't work for Linq-to-Database entities.)
227
335
/// </summary>
@@ -237,6 +345,13 @@ public static LambdaExpression ParseLambda([CanBeNull] ParsingConfig parsingConf
237
345
return ParseLambda ( parsingConfig , true , parameters , resultType , expression , values ) ;
238
346
}
239
347
348
+ // NEED TEXT!
349
+ [ PublicAPI ]
350
+ public static LambdaExpression ParseLambda ( [ CanBeNull ] Type delegateType , [ CanBeNull ] ParsingConfig parsingConfig , [ NotNull ] ParameterExpression [ ] parameters , [ CanBeNull ] Type resultType , string expression , params object [ ] values )
351
+ {
352
+ return ParseLambda ( delegateType , parsingConfig , true , parameters , resultType , expression , values ) ;
353
+ }
354
+
240
355
/// <summary>
241
356
/// Parses an expression into a LambdaExpression.
242
357
/// </summary>
0 commit comments