@@ -293,15 +293,15 @@ public void GetProperties_JsonComplexType_ReturnsCorrectColumnInformation()
293293 Assert . NotNull ( streetWriter ) ;
294294 Assert . Equal ( "Street" , streetWriter . JsonPropertyName ) ;
295295 Assert . Equal ( "Street" , streetWriter . FullJsonPropertyName ) ;
296- Assert . Equal ( "Street" , streetWriter . FullClrPropertyName ) ;
296+ Assert . Equal ( "ShippingAddress. Street" , streetWriter . FullClrPropertyName ) ;
297297 Assert . Equal ( typeof ( string ) , streetWriter . PropertyType ) ;
298298 Assert . False ( streetWriter . IsNestedComplexType ) ;
299299
300300 var locationWriter = jsonProperties . FirstOrDefault ( w => w . ClrPropertyName == "Location" ) ;
301301 Assert . NotNull ( locationWriter ) ;
302302 Assert . Equal ( "xxx" , locationWriter . JsonPropertyName ) ; // Mapped to "xxx" in TestDbContext
303303 Assert . Equal ( "xxx" , locationWriter . FullJsonPropertyName ) ;
304- Assert . Equal ( "Location" , locationWriter . FullClrPropertyName ) ;
304+ Assert . Equal ( "ShippingAddress. Location" , locationWriter . FullClrPropertyName ) ;
305305 Assert . Equal ( typeof ( ComplexTypeLocation ) , locationWriter . PropertyType ) ;
306306 Assert . True ( locationWriter . IsNestedComplexType ) ;
307307 Assert . NotNull ( locationWriter . NestedProperties ) ;
@@ -310,27 +310,32 @@ public void GetProperties_JsonComplexType_ReturnsCorrectColumnInformation()
310310 var latWriter = locationWriter . NestedProperties . FirstOrDefault ( w => w . ClrPropertyName == "Lat" ) ;
311311 Assert . NotNull ( latWriter ) ;
312312 Assert . Equal ( "xxx.Lat" , latWriter . FullJsonPropertyName ) ;
313- Assert . Equal ( "Location.Lat" , latWriter . FullClrPropertyName ) ;
313+ Assert . Equal ( "ShippingAddress. Location.Lat" , latWriter . FullClrPropertyName ) ;
314314 Assert . Equal ( typeof ( double ) , latWriter . PropertyType ) ;
315315
316316 var lngWriter = locationWriter . NestedProperties . FirstOrDefault ( w => w . ClrPropertyName == "Lng" ) ;
317317 Assert . NotNull ( lngWriter ) ;
318318 Assert . Equal ( "xxx.Lng" , lngWriter . FullJsonPropertyName ) ;
319- Assert . Equal ( "Location.Lng" , lngWriter . FullClrPropertyName ) ;
319+ Assert . Equal ( "ShippingAddress. Location.Lng" , lngWriter . FullClrPropertyName ) ;
320320 Assert . Equal ( typeof ( double ) , lngWriter . PropertyType ) ;
321321
322322 // Verify serialization using JsonProperties
323- var testAddress = new ComplexTypeAddress
323+
324+ var testOrder = new JsonComplexTypeOrder
324325 {
325- Street = "123 Main St" ,
326- Location = new ComplexTypeLocation
326+ Id = 1 ,
327+ ShippingAddress = new ComplexTypeAddress
327328 {
328- Lat = 40.7128 ,
329- Lng = - 74.0060
329+ Street = "123 Main St" ,
330+ Location = new ComplexTypeLocation
331+ {
332+ Lat = 40.7128 ,
333+ Lng = - 74.0060
334+ }
330335 }
331336 } ;
332337
333- var json = JsonProperty . Serialize ( testAddress , jsonProperties ) ;
338+ var json = JsonPropertyWriter . Write ( testOrder , flattenedJsonProperties ) ;
334339 Assert . NotNull ( json ) ;
335340 Assert . Contains ( "Street" , json ) ;
336341 Assert . Contains ( "123 Main St" , json ) ;
@@ -382,15 +387,15 @@ public void GetProperties_JsonOwnedType_ReturnsCorrectColumnInformation()
382387 Assert . NotNull ( streetWriter ) ;
383388 Assert . Equal ( "Street" , streetWriter . JsonPropertyName ) ;
384389 Assert . Equal ( "Street" , streetWriter . FullJsonPropertyName ) ;
385- Assert . Equal ( "Street" , streetWriter . FullClrPropertyName ) ;
390+ Assert . Equal ( "ShippingAddress. Street" , streetWriter . FullClrPropertyName ) ;
386391 Assert . Equal ( typeof ( string ) , streetWriter . PropertyType ) ;
387392 Assert . False ( streetWriter . IsNestedComplexType ) ;
388393
389394 var locationWriter = jsonProperties . FirstOrDefault ( w => w . ClrPropertyName == "Location" ) ;
390395 Assert . NotNull ( locationWriter ) ;
391396 Assert . Equal ( "xxx" , locationWriter . JsonPropertyName ) ; // Mapped to "xxx" in TestDbContext
392397 Assert . Equal ( "xxx" , locationWriter . FullJsonPropertyName ) ;
393- Assert . Equal ( "Location" , locationWriter . FullClrPropertyName ) ;
398+ Assert . Equal ( "ShippingAddress. Location" , locationWriter . FullClrPropertyName ) ;
394399 Assert . Equal ( typeof ( OwnedTypeLocation ) , locationWriter . PropertyType ) ;
395400 Assert . True ( locationWriter . IsNestedComplexType ) ;
396401 Assert . NotNull ( locationWriter . NestedProperties ) ;
@@ -399,27 +404,31 @@ public void GetProperties_JsonOwnedType_ReturnsCorrectColumnInformation()
399404 var latWriter = locationWriter . NestedProperties . FirstOrDefault ( w => w . ClrPropertyName == "Lat" ) ;
400405 Assert . NotNull ( latWriter ) ;
401406 Assert . Equal ( "xxx.Lat" , latWriter . FullJsonPropertyName ) ;
402- Assert . Equal ( "Location.Lat" , latWriter . FullClrPropertyName ) ;
407+ Assert . Equal ( "ShippingAddress. Location.Lat" , latWriter . FullClrPropertyName ) ;
403408 Assert . Equal ( typeof ( double ) , latWriter . PropertyType ) ;
404409
405410 var lngWriter = locationWriter . NestedProperties . FirstOrDefault ( w => w . ClrPropertyName == "Lng" ) ;
406411 Assert . NotNull ( lngWriter ) ;
407412 Assert . Equal ( "xxx.Lng" , lngWriter . FullJsonPropertyName ) ;
408- Assert . Equal ( "Location.Lng" , lngWriter . FullClrPropertyName ) ;
413+ Assert . Equal ( "ShippingAddress. Location.Lng" , lngWriter . FullClrPropertyName ) ;
409414 Assert . Equal ( typeof ( double ) , lngWriter . PropertyType ) ;
410415
411416 // Verify serialization using JsonProperties
412- var testAddress = new OwnedTypeAddress
417+ var testOrder = new JsonOwnedTypeOrder
413418 {
414- Street = "123 Main St" ,
415- Location = new OwnedTypeLocation
419+ Id = 1 ,
420+ ShippingAddress = new OwnedTypeAddress
416421 {
417- Lat = 40.7128 ,
418- Lng = - 74.0060
422+ Street = "123 Main St" ,
423+ Location = new OwnedTypeLocation
424+ {
425+ Lat = 40.7128 ,
426+ Lng = - 74.0060
427+ }
419428 }
420429 } ;
421430
422- var json = JsonProperty . Serialize ( testAddress , jsonProperties ) ;
431+ var json = JsonPropertyWriter . Write ( testOrder , flattenedJsonProperties ) ;
423432 Assert . NotNull ( json ) ;
424433 Assert . Contains ( "Street" , json ) ;
425434 Assert . Contains ( "123 Main St" , json ) ;
@@ -469,15 +478,15 @@ public void GetProperties_JsonComplexOwnedType_ReturnsCorrectColumnInformation()
469478 Assert . NotNull ( streetWriter ) ;
470479 Assert . Equal ( "Street" , streetWriter . JsonPropertyName ) ;
471480 Assert . Equal ( "Street" , streetWriter . FullJsonPropertyName ) ;
472- Assert . Equal ( "Street" , streetWriter . FullClrPropertyName ) ;
481+ Assert . Equal ( "ComplexShippingAddress. Street" , streetWriter . FullClrPropertyName ) ;
473482 Assert . Equal ( typeof ( string ) , streetWriter . PropertyType ) ;
474483 Assert . False ( streetWriter . IsNestedComplexType ) ;
475484
476485 var locationWriter = jsonProperties . FirstOrDefault ( w => w . ClrPropertyName == "Location" ) ;
477486 Assert . NotNull ( locationWriter ) ;
478487 Assert . Equal ( "xxx" , locationWriter . JsonPropertyName ) ; // Mapped to "xxx" in TestDbContext
479488 Assert . Equal ( "xxx" , locationWriter . FullJsonPropertyName ) ;
480- Assert . Equal ( "Location" , locationWriter . FullClrPropertyName ) ;
489+ Assert . Equal ( "ComplexShippingAddress. Location" , locationWriter . FullClrPropertyName ) ;
481490 Assert . Equal ( typeof ( ComplexTypeLocation ) , locationWriter . PropertyType ) ;
482491 Assert . True ( locationWriter . IsNestedComplexType ) ;
483492 Assert . NotNull ( locationWriter . NestedProperties ) ;
@@ -486,27 +495,31 @@ public void GetProperties_JsonComplexOwnedType_ReturnsCorrectColumnInformation()
486495 var latWriter = locationWriter . NestedProperties . FirstOrDefault ( w => w . ClrPropertyName == "Lat" ) ;
487496 Assert . NotNull ( latWriter ) ;
488497 Assert . Equal ( "xxx.Lat" , latWriter . FullJsonPropertyName ) ;
489- Assert . Equal ( "Location.Lat" , latWriter . FullClrPropertyName ) ;
498+ Assert . Equal ( "ComplexShippingAddress. Location.Lat" , latWriter . FullClrPropertyName ) ;
490499 Assert . Equal ( typeof ( double ) , latWriter . PropertyType ) ;
491500
492501 var lngWriter = locationWriter . NestedProperties . FirstOrDefault ( w => w . ClrPropertyName == "Lng" ) ;
493502 Assert . NotNull ( lngWriter ) ;
494503 Assert . Equal ( "xxx.Lng" , lngWriter . FullJsonPropertyName ) ;
495- Assert . Equal ( "Location.Lng" , lngWriter . FullClrPropertyName ) ;
504+ Assert . Equal ( "ComplexShippingAddress. Location.Lng" , lngWriter . FullClrPropertyName ) ;
496505 Assert . Equal ( typeof ( double ) , lngWriter . PropertyType ) ;
497506
498507 // Verify serialization using JsonProperties
499- var testComplexAddress = new ComplexTypeAddress
508+ var testOrder = new JsonComplexOwnedTypeOrder
500509 {
501- Street = "123 Main St" ,
502- Location = new ComplexTypeLocation
510+ Id = 1 ,
511+ ComplexShippingAddress = new ComplexTypeAddress
503512 {
504- Lat = 40.7128 ,
505- Lng = - 74.0060
513+ Street = "123 Main St" ,
514+ Location = new ComplexTypeLocation
515+ {
516+ Lat = 40.7128 ,
517+ Lng = - 74.0060
518+ }
506519 }
507520 } ;
508521
509- var json = JsonProperty . Serialize ( testComplexAddress , jsonProperties ) ;
522+ var json = JsonPropertyWriter . Write ( testOrder , flattenedJsonProperties ) ;
510523 Assert . NotNull ( json ) ;
511524 Assert . Contains ( "Street" , json ) ;
512525 Assert . Contains ( "123 Main St" , json ) ;
@@ -534,15 +547,15 @@ public void GetProperties_JsonComplexOwnedType_ReturnsCorrectColumnInformation()
534547 Assert . NotNull ( streetWriter ) ;
535548 Assert . Equal ( "Street" , streetWriter . JsonPropertyName ) ;
536549 Assert . Equal ( "Street" , streetWriter . FullJsonPropertyName ) ;
537- Assert . Equal ( "Street" , streetWriter . FullClrPropertyName ) ;
550+ Assert . Equal ( "OwnedShippingAddress. Street" , streetWriter . FullClrPropertyName ) ;
538551 Assert . Equal ( typeof ( string ) , streetWriter . PropertyType ) ;
539552 Assert . False ( streetWriter . IsNestedComplexType ) ;
540553
541554 locationWriter = jsonProperties . FirstOrDefault ( w => w . ClrPropertyName == "Location" ) ;
542555 Assert . NotNull ( locationWriter ) ;
543556 Assert . Equal ( "xxx" , locationWriter . JsonPropertyName ) ; // Mapped to "xxx" in TestDbContext
544557 Assert . Equal ( "xxx" , locationWriter . FullJsonPropertyName ) ;
545- Assert . Equal ( "Location" , locationWriter . FullClrPropertyName ) ;
558+ Assert . Equal ( "OwnedShippingAddress. Location" , locationWriter . FullClrPropertyName ) ;
546559 Assert . Equal ( typeof ( OwnedTypeLocation ) , locationWriter . PropertyType ) ;
547560 Assert . True ( locationWriter . IsNestedComplexType ) ;
548561 Assert . NotNull ( locationWriter . NestedProperties ) ;
@@ -551,27 +564,31 @@ public void GetProperties_JsonComplexOwnedType_ReturnsCorrectColumnInformation()
551564 latWriter = locationWriter . NestedProperties . FirstOrDefault ( w => w . ClrPropertyName == "Lat" ) ;
552565 Assert . NotNull ( latWriter ) ;
553566 Assert . Equal ( "xxx.Lat" , latWriter . FullJsonPropertyName ) ;
554- Assert . Equal ( "Location.Lat" , latWriter . FullClrPropertyName ) ;
567+ Assert . Equal ( "OwnedShippingAddress. Location.Lat" , latWriter . FullClrPropertyName ) ;
555568 Assert . Equal ( typeof ( double ) , latWriter . PropertyType ) ;
556569
557570 lngWriter = locationWriter . NestedProperties . FirstOrDefault ( w => w . ClrPropertyName == "Lng" ) ;
558571 Assert . NotNull ( lngWriter ) ;
559572 Assert . Equal ( "xxx.Lng" , lngWriter . FullJsonPropertyName ) ;
560- Assert . Equal ( "Location.Lng" , lngWriter . FullClrPropertyName ) ;
573+ Assert . Equal ( "OwnedShippingAddress. Location.Lng" , lngWriter . FullClrPropertyName ) ;
561574 Assert . Equal ( typeof ( double ) , lngWriter . PropertyType ) ;
562575
563576 // Verify serialization using JsonProperties
564- var testOwnedAddress = new OwnedTypeAddress
577+ testOrder = new JsonComplexOwnedTypeOrder
565578 {
566- Street = "123 Main St" ,
567- Location = new OwnedTypeLocation
579+ Id = 1 ,
580+ OwnedShippingAddress = new OwnedTypeAddress
568581 {
569- Lat = 40.7128 ,
570- Lng = - 74.0060
582+ Street = "123 Main St" ,
583+ Location = new OwnedTypeLocation
584+ {
585+ Lat = 40.7128 ,
586+ Lng = - 74.0060
587+ }
571588 }
572589 } ;
573590
574- json = JsonProperty . Serialize ( testOwnedAddress , jsonProperties ) ;
591+ json = JsonPropertyWriter . Write ( testOrder , flattenedJsonProperties ) ;
575592 Assert . NotNull ( json ) ;
576593 Assert . Contains ( "Street" , json ) ;
577594 Assert . Contains ( "123 Main St" , json ) ;
0 commit comments