15
15
*/
16
16
17
17
using System ;
18
+ using MongoDB . Driver . Linq . Linq3Implementation . Misc ;
18
19
19
20
namespace MongoDB . Driver . Linq
20
21
{
@@ -32,7 +33,7 @@ public static class DateTimeExtensions
32
33
/// <returns>The resulting DateTime.</returns>
33
34
public static DateTime Add ( this DateTime @this , long value , DateTimeUnit unit )
34
35
{
35
- throw new InvalidOperationException ( "This DateTime.Add method is only intended to be used in LINQ queries." ) ;
36
+ throw CustomLinqExtensionMethodHelper . CreateNotSupportedException ( ) ;
36
37
}
37
38
38
39
/// <summary>
@@ -46,7 +47,7 @@ public static DateTime Add(this DateTime @this, long value, DateTimeUnit unit)
46
47
/// <remarks>See the server documentation for $dateAdd for information on timezones in MongoDB.</remarks>
47
48
public static DateTime Add ( this DateTime @this , long value , DateTimeUnit unit , string timezone )
48
49
{
49
- throw new InvalidOperationException ( "This DateTime.Add method is only intended to be used in LINQ queries." ) ;
50
+ throw CustomLinqExtensionMethodHelper . CreateNotSupportedException ( ) ;
50
51
}
51
52
52
53
/// <summary>
@@ -59,7 +60,7 @@ public static DateTime Add(this DateTime @this, long value, DateTimeUnit unit, s
59
60
/// <remarks>See the server documentation for $dateAdd for information on timezones in MongoDB.</remarks>
60
61
public static DateTime Add ( this DateTime @this , TimeSpan value , string timezone )
61
62
{
62
- throw new InvalidOperationException ( "This DateTime.Add method is only intended to be used in LINQ queries." ) ;
63
+ throw CustomLinqExtensionMethodHelper . CreateNotSupportedException ( ) ;
63
64
}
64
65
65
66
/// <summary>
@@ -72,7 +73,7 @@ public static DateTime Add(this DateTime @this, TimeSpan value, string timezone)
72
73
/// <remarks>See the server documentation for $dateAdd for information on timezones in MongoDB.</remarks>
73
74
public static DateTime AddDays ( this DateTime @this , double value , string timezone )
74
75
{
75
- throw new InvalidOperationException ( "This DateTime.AddDays method is only intended to be used in LINQ queries." ) ;
76
+ throw CustomLinqExtensionMethodHelper . CreateNotSupportedException ( ) ;
76
77
}
77
78
78
79
/// <summary>
@@ -85,7 +86,7 @@ public static DateTime AddDays(this DateTime @this, double value, string timezon
85
86
/// <remarks>See the server documentation for $dateAdd for information on timezones in MongoDB.</remarks>
86
87
public static DateTime AddHours ( this DateTime @this , double value , string timezone )
87
88
{
88
- throw new InvalidOperationException ( "This DateTime.AddHours method is only intended to be used in LINQ queries." ) ;
89
+ throw CustomLinqExtensionMethodHelper . CreateNotSupportedException ( ) ;
89
90
}
90
91
91
92
/// <summary>
@@ -98,7 +99,7 @@ public static DateTime AddHours(this DateTime @this, double value, string timezo
98
99
/// <remarks>See the server documentation for $dateAdd for information on timezones in MongoDB.</remarks>
99
100
public static DateTime AddMilliseconds ( this DateTime @this , double value , string timezone )
100
101
{
101
- throw new InvalidOperationException ( "This DateTime.AddMilliseconds method is only intended to be used in LINQ queries." ) ;
102
+ throw CustomLinqExtensionMethodHelper . CreateNotSupportedException ( ) ;
102
103
}
103
104
104
105
/// <summary>
@@ -111,7 +112,7 @@ public static DateTime AddMilliseconds(this DateTime @this, double value, string
111
112
/// <remarks>See the server documentation for $dateAdd for information on timezones in MongoDB.</remarks>
112
113
public static DateTime AddMinutes ( this DateTime @this , double value , string timezone )
113
114
{
114
- throw new InvalidOperationException ( "This DateTime.AddMinutes method is only intended to be used in LINQ queries." ) ;
115
+ throw CustomLinqExtensionMethodHelper . CreateNotSupportedException ( ) ;
115
116
}
116
117
117
118
/// <summary>
@@ -124,7 +125,7 @@ public static DateTime AddMinutes(this DateTime @this, double value, string time
124
125
/// <remarks>See the server documentation for $dateAdd for information on timezones in MongoDB.</remarks>
125
126
public static DateTime AddMonths ( this DateTime @this , int value , string timezone )
126
127
{
127
- throw new InvalidOperationException ( "This DateTime.AddMonths method is only intended to be used in LINQ queries." ) ;
128
+ throw CustomLinqExtensionMethodHelper . CreateNotSupportedException ( ) ;
128
129
}
129
130
130
131
/// <summary>
@@ -135,7 +136,7 @@ public static DateTime AddMonths(this DateTime @this, int value, string timezone
135
136
/// <returns>The resulting DateTime.</returns>
136
137
public static DateTime AddQuarters ( this DateTime @this , int value )
137
138
{
138
- throw new InvalidOperationException ( "This DateTime.AddQuarters method is only intended to be used in LINQ queries." ) ;
139
+ throw CustomLinqExtensionMethodHelper . CreateNotSupportedException ( ) ;
139
140
}
140
141
141
142
/// <summary>
@@ -148,7 +149,7 @@ public static DateTime AddQuarters(this DateTime @this, int value)
148
149
/// <remarks>See the server documentation for $dateAdd for information on timezones in MongoDB.</remarks>
149
150
public static DateTime AddQuarters ( this DateTime @this , int value , string timezone )
150
151
{
151
- throw new InvalidOperationException ( "This DateTime.AddQuarters method is only intended to be used in LINQ queries." ) ;
152
+ throw CustomLinqExtensionMethodHelper . CreateNotSupportedException ( ) ;
152
153
}
153
154
154
155
/// <summary>
@@ -161,7 +162,7 @@ public static DateTime AddQuarters(this DateTime @this, int value, string timezo
161
162
/// <remarks>See the server documentation for $dateAdd for information on timezones in MongoDB.</remarks>
162
163
public static DateTime AddSeconds ( this DateTime @this , double value , string timezone )
163
164
{
164
- throw new InvalidOperationException ( "This DateTime.AddSeconds method is only intended to be used in LINQ queries." ) ;
165
+ throw CustomLinqExtensionMethodHelper . CreateNotSupportedException ( ) ;
165
166
}
166
167
167
168
/// <summary>
@@ -172,7 +173,7 @@ public static DateTime AddSeconds(this DateTime @this, double value, string time
172
173
/// <returns>The resulting DateTime.</returns>
173
174
public static DateTime AddWeeks ( this DateTime @this , int value )
174
175
{
175
- throw new InvalidOperationException ( "The DateTime.AddWeeks method is only intended to be used in LINQ queries." ) ;
176
+ throw CustomLinqExtensionMethodHelper . CreateNotSupportedException ( ) ;
176
177
}
177
178
178
179
/// <summary>
@@ -185,7 +186,7 @@ public static DateTime AddWeeks(this DateTime @this, int value)
185
186
/// <remarks>See the server documentation for $dateAdd for information on timezones in MongoDB.</remarks>
186
187
public static DateTime AddWeeks ( this DateTime @this , int value , string timezone )
187
188
{
188
- throw new InvalidOperationException ( "This DateTime.AddWeeks method is only intended to be used in LINQ queries." ) ;
189
+ throw CustomLinqExtensionMethodHelper . CreateNotSupportedException ( ) ;
189
190
}
190
191
191
192
/// <summary>
@@ -198,7 +199,7 @@ public static DateTime AddWeeks(this DateTime @this, int value, string timezone)
198
199
/// <remarks>See the server documentation for $dateAdd for information on timezones in MongoDB.</remarks>
199
200
public static DateTime AddYears ( this DateTime @this , int value , string timezone )
200
201
{
201
- throw new InvalidOperationException ( "This DateTime.AddYears method is only intended to be used in LINQ queries." ) ;
202
+ throw CustomLinqExtensionMethodHelper . CreateNotSupportedException ( ) ;
202
203
}
203
204
204
205
/// <summary>
@@ -210,7 +211,7 @@ public static DateTime AddYears(this DateTime @this, int value, string timezone)
210
211
/// <returns>The result.</returns>
211
212
public static long Subtract ( this DateTime @this , DateTime startDate , DateTimeUnit unit )
212
213
{
213
- throw new InvalidOperationException ( "This DateTime.Subtract method is only intended to be used in LINQ queries." ) ;
214
+ throw CustomLinqExtensionMethodHelper . CreateNotSupportedException ( ) ;
214
215
}
215
216
216
217
/// <summary>
@@ -224,7 +225,7 @@ public static long Subtract(this DateTime @this, DateTime startDate, DateTimeUni
224
225
/// <remarks>See the server documentation for $dateDiff for information on timezones in MongoDB.</remarks>
225
226
public static long Subtract ( this DateTime @this , DateTime startDate , DateTimeUnit unit , string timezone )
226
227
{
227
- throw new InvalidOperationException ( "This DateTime.Subtract method is only intended to be used in LINQ queries." ) ;
228
+ throw CustomLinqExtensionMethodHelper . CreateNotSupportedException ( ) ;
228
229
}
229
230
230
231
/// <summary>
@@ -237,7 +238,7 @@ public static long Subtract(this DateTime @this, DateTime startDate, DateTimeUni
237
238
/// <remarks>See the server documentation for $dateDiff for information on timezones in MongoDB.</remarks>
238
239
public static TimeSpan Subtract ( this DateTime @this , DateTime value , string timezone )
239
240
{
240
- throw new InvalidOperationException ( "This DateTime.Subtract method is only intended to be used in LINQ queries." ) ;
241
+ throw CustomLinqExtensionMethodHelper . CreateNotSupportedException ( ) ;
241
242
}
242
243
243
244
/// <summary>
@@ -250,7 +251,7 @@ public static TimeSpan Subtract(this DateTime @this, DateTime value, string time
250
251
/// <remarks>See the server documentation for $dateSubtract for information on timezones in MongoDB.</remarks>
251
252
public static DateTime Subtract ( this DateTime @this , TimeSpan value , string timezone )
252
253
{
253
- throw new InvalidOperationException ( "This DateTime.Subtract method is only intended to be used in LINQ queries." ) ;
254
+ throw CustomLinqExtensionMethodHelper . CreateNotSupportedException ( ) ;
254
255
}
255
256
256
257
/// <summary>
@@ -262,7 +263,7 @@ public static DateTime Subtract(this DateTime @this, TimeSpan value, string time
262
263
/// <returns>The resulting DateTime.</returns>
263
264
public static DateTime Subtract ( this DateTime @this , long value , DateTimeUnit unit )
264
265
{
265
- throw new InvalidOperationException ( "This DateTime.Subtract method is only intended to be used in LINQ queries." ) ;
266
+ throw CustomLinqExtensionMethodHelper . CreateNotSupportedException ( ) ;
266
267
}
267
268
268
269
/// <summary>
@@ -276,7 +277,7 @@ public static DateTime Subtract(this DateTime @this, long value, DateTimeUnit un
276
277
/// <remarks>See the server documentation for $dateSubtract for information on timezones in MongoDB.</remarks>
277
278
public static DateTime Subtract ( this DateTime @this , long value , DateTimeUnit unit , string timezone )
278
279
{
279
- throw new InvalidOperationException ( "This DateTime.Subtract method is only intended to be used in LINQ queries." ) ;
280
+ throw CustomLinqExtensionMethodHelper . CreateNotSupportedException ( ) ;
280
281
}
281
282
282
283
/// <summary>
@@ -288,7 +289,7 @@ public static DateTime Subtract(this DateTime @this, long value, DateTimeUnit un
288
289
/// <returns>The DateTime value converted to a string.</returns>
289
290
public static string ToString ( this DateTime @this , string format , string timezone )
290
291
{
291
- throw new InvalidOperationException ( "This DateTime.ToString method is only intended to be used in LINQ queries." ) ;
292
+ throw CustomLinqExtensionMethodHelper . CreateNotSupportedException ( ) ;
292
293
}
293
294
294
295
/// <summary>
@@ -299,7 +300,7 @@ public static string ToString(this DateTime @this, string format, string timezon
299
300
/// <returns>The resulting DateTime.</returns>
300
301
public static DateTime Truncate ( this DateTime @this , DateTimeUnit unit )
301
302
{
302
- throw new InvalidOperationException ( "This DateTime.Truncate method is only intended to be used in LINQ queries." ) ;
303
+ throw CustomLinqExtensionMethodHelper . CreateNotSupportedException ( ) ;
303
304
}
304
305
305
306
/// <summary>
@@ -311,7 +312,7 @@ public static DateTime Truncate(this DateTime @this, DateTimeUnit unit)
311
312
/// <returns>The resulting DateTime.</returns>
312
313
public static DateTime Truncate ( this DateTime @this , DateTimeUnit unit , long binSize )
313
314
{
314
- throw new InvalidOperationException ( "This DateTime.Truncate method is only intended to be used in LINQ queries." ) ;
315
+ throw CustomLinqExtensionMethodHelper . CreateNotSupportedException ( ) ;
315
316
}
316
317
317
318
/// <summary>
@@ -325,7 +326,7 @@ public static DateTime Truncate(this DateTime @this, DateTimeUnit unit, long bin
325
326
/// <remarks>See the server documentation for $dateTrunc for information on timezones in MongoDB.</remarks>
326
327
public static DateTime Truncate ( this DateTime @this , DateTimeUnit unit , long binSize , string timezone )
327
328
{
328
- throw new InvalidOperationException ( "This DateTime.Truncate method is only intended to be used in LINQ queries." ) ;
329
+ throw CustomLinqExtensionMethodHelper . CreateNotSupportedException ( ) ;
329
330
}
330
331
331
332
/// <summary>
@@ -335,7 +336,7 @@ public static DateTime Truncate(this DateTime @this, DateTimeUnit unit, long bin
335
336
/// <returns>The week number of a specified DateTime value.</returns>
336
337
public static int Week ( this DateTime @this )
337
338
{
338
- throw new InvalidOperationException ( "This DateTime.Week method is only intended to be used in LINQ queries." ) ;
339
+ throw CustomLinqExtensionMethodHelper . CreateNotSupportedException ( ) ;
339
340
}
340
341
341
342
/// <summary>
@@ -346,7 +347,7 @@ public static int Week(this DateTime @this)
346
347
/// <returns>The week number of a specified DateTime value.</returns>
347
348
public static int Week ( this DateTime @this , string timezone )
348
349
{
349
- throw new InvalidOperationException ( "This DateTime.Week method is only intended to be used in LINQ queries." ) ;
350
+ throw CustomLinqExtensionMethodHelper . CreateNotSupportedException ( ) ;
350
351
}
351
352
}
352
353
}
0 commit comments