@@ -169,13 +169,13 @@ private static void LikeTests(TestContext context, ParsingConfig config)
169
169
var dynamicCarsLike2 = context . Cars . Where ( config , "TestContext.Like(Brand, \" %d%\" )" ) ;
170
170
Console . WriteLine ( "dynamicCarsLike2 {0}" , JsonConvert . SerializeObject ( dynamicCarsLike2 , Formatting . Indented ) ) ;
171
171
172
- var dynamicFunctionsLike1 = context . Cars . Where ( config , "DynamicFunctions.Like(Brand, \" %a%\" )" ) ;
173
- Console . WriteLine ( "dynamicFunctionsLike1 {0}" ,
174
- JsonConvert . SerializeObject ( dynamicFunctionsLike1 , Formatting . Indented ) ) ;
172
+ // var dynamicFunctionsLike1 = context.Cars.Where(config, "DynamicFunctions.Like(Brand, \"%a%\")");
173
+ // Console.WriteLine("dynamicFunctionsLike1 {0}",
174
+ // JsonConvert.SerializeObject(dynamicFunctionsLike1, Formatting.Indented));
175
175
176
- var dynamicFunctionsLike2 = context . Cars . Where ( config , "DynamicFunctions.Like(Vin, \" %a.%b%\" , \" .\" )" ) ;
177
- Console . WriteLine ( "dynamicFunctionsLike2 {0}" ,
178
- JsonConvert . SerializeObject ( dynamicFunctionsLike2 , Formatting . Indented ) ) ;
176
+ // var dynamicFunctionsLike2 = context.Cars.Where(config, "DynamicFunctions.Like(Vin, \"%a.%b%\", \".\")");
177
+ // Console.WriteLine("dynamicFunctionsLike2 {0}",
178
+ // JsonConvert.SerializeObject(dynamicFunctionsLike2, Formatting.Indented));
179
179
}
180
180
181
181
private static void OfTypeAndCastTests ( TestContext context , ParsingConfig config )
@@ -185,9 +185,29 @@ private static void OfTypeAndCastTests(TestContext context, ParsingConfig config
185
185
var castDynamicWithString = context . BaseDtos . Where ( b => b is TestDto ) . Cast ( config , "ConsoleAppEF2.Database.TestDto" ) . ToDynamicArray ( ) ;
186
186
187
187
var oftype = context . BaseDtos . OfType < TestDto > ( ) . ToArray ( ) ;
188
+ bool ofTypeAny = context . BaseDtos . OfType < TestDto > ( ) . Any ( ) ;
188
189
var oftypeDynamicWithType = context . BaseDtos . OfType ( typeof ( TestDto ) ) . ToDynamicArray ( ) ;
189
190
var oftypeDynamicWithString = context . BaseDtos . OfType ( config , "ConsoleAppEF2.Database.TestDto" ) . ToDynamicArray ( ) ;
190
191
192
+ var configX = new ParsingConfig
193
+ {
194
+ ResolveTypesBySimpleName = true
195
+ } ;
196
+ var oftypeDynamicWithSimpleNameString = context . BaseDtos . OfType ( configX , "TestDto" ) . ToDynamicArray ( ) ;
197
+
198
+ int isOfType = context . BaseDtos . Count ( b => b is TestDto ) ;
199
+ int isOfTypeDynamicTestDto = context . BaseDtos . Count ( config , "OfType(\" ConsoleAppEF2.Database.TestDto\" )" ) ;
200
+ int isOfTypeDynamicOtherTestDto = context . BaseDtos . Count ( config , "OfType(\" ConsoleAppEF2.Database.OtherTestDto\" )" ) ;
201
+ int isOfTypeDynamicComplexDto = context . BaseDtos . Count ( config , "OfType(\" ConsoleAppEF2.Database.ComplexDto\" )" ) ;
202
+
203
+ var asOfType = context . BaseDtos . Where ( b => b as TestDto != null ) . ToArray ( ) ;
204
+ var asOfTypeDynamicTestDto = context . BaseDtos . Where ( config , "As(\" ConsoleAppEF2.Database.TestDto\" ) != null" ) . ToDynamicArray ( ) ;
205
+ var asOfTypeDynamicOtherTestDto = context . BaseDtos . Where ( config , "As(\" ConsoleAppEF2.Database.OtherTestDto\" ) != null" ) . ToDynamicArray ( ) ;
206
+ var asOfTypeDynamicComplexDto = context . BaseDtos . Where ( config , "As(\" ConsoleAppEF2.Database.ComplexDto\" ) != null" ) . ToDynamicArray ( ) ;
207
+
208
+ var castOnX = context . BaseDtos . Where ( b => b as TestDto != null ) . Where ( b => ( ( TestDto ) b ) . Name != null ) . ToArray ( ) ;
209
+ var castOnXDynamic = context . BaseDtos . Where ( b => b as TestDto != null ) . Where ( config , "Cast(\" ConsoleAppEF2.Database.TestDto\" ).Name != null" ) . ToArray ( ) ;
210
+
191
211
var oftypeTestDto = context . BaseDtos . OfType < TestDto > ( ) . Where ( x => x . Name == "t" ) . ToArray ( ) ;
192
212
var oftypeTestDtoDynamic = context . BaseDtos . OfType < TestDto > ( ) . Where ( "Name == \" t\" " ) . ToArray ( ) ;
193
213
0 commit comments