Browse Source
Merge pull request #17240 from abpframework/auto-merge/rel-7-3/2096
pull/17246/head
maliming
3 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with
37 additions and
3 deletions
-
framework/src/Volo.Abp.AutoMapper/AutoMapper/AbpAutoMapperExtensibleDtoExtensions.cs
-
framework/src/Volo.Abp.EventBus.RabbitMQ/Volo/Abp/EventBus/RabbitMq/RabbitMqDistributedEventBus.cs
-
framework/test/Volo.Abp.AutoMapper.Tests/AutoMapper/AbpAutoMapperExtensibleDtoExtensions_Tests.cs
-
framework/test/Volo.Abp.ObjectExtending.Tests/Volo/Abp/ObjectExtending/TestObjects/ExtensibleTestPerson.cs
-
framework/test/Volo.Abp.ObjectExtending.Tests/Volo/Abp/ObjectExtending/TestObjects/ExtensibleTestPersonDto.cs
|
|
@ -1,4 +1,5 @@ |
|
|
using System.Collections.Generic; |
|
|
using System.Collections.Generic; |
|
|
|
|
|
using Volo.Abp; |
|
|
using Volo.Abp.AutoMapper; |
|
|
using Volo.Abp.AutoMapper; |
|
|
using Volo.Abp.Data; |
|
|
using Volo.Abp.Data; |
|
|
using Volo.Abp.ObjectExtending; |
|
|
using Volo.Abp.ObjectExtending; |
|
|
@ -25,6 +26,11 @@ public static class AbpAutoMapperExtensibleDtoExtensions |
|
|
? new Dictionary<string, object?>() |
|
|
? new Dictionary<string, object?>() |
|
|
: new Dictionary<string, object?>(extraProps); |
|
|
: new Dictionary<string, object?>(extraProps); |
|
|
|
|
|
|
|
|
|
|
|
if (source.ExtraProperties == null || destination.ExtraProperties == null) |
|
|
|
|
|
{ |
|
|
|
|
|
return result; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
ExtensibleObjectMapper |
|
|
ExtensibleObjectMapper |
|
|
.MapExtraPropertiesTo<TSource, TDestination>( |
|
|
.MapExtraPropertiesTo<TSource, TDestination>( |
|
|
source.ExtraProperties, |
|
|
source.ExtraProperties, |
|
|
|
|
|
@ -350,7 +350,10 @@ public class RabbitMqDistributedEventBus : DistributedEventBusBase, ISingletonDe |
|
|
|
|
|
|
|
|
try |
|
|
try |
|
|
{ |
|
|
{ |
|
|
channel.ExchangeDeclarePassive(AbpRabbitMqEventBusOptions.ExchangeName); |
|
|
using (var temporaryChannel = ConnectionPool.Get(AbpRabbitMqEventBusOptions.ConnectionName).CreateModel()) |
|
|
|
|
|
{ |
|
|
|
|
|
temporaryChannel.ExchangeDeclarePassive(AbpRabbitMqEventBusOptions.ExchangeName); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
catch (Exception) |
|
|
catch (Exception) |
|
|
{ |
|
|
{ |
|
|
|
|
|
@ -1,5 +1,7 @@ |
|
|
using Microsoft.Extensions.DependencyInjection; |
|
|
using System.Collections.Generic; |
|
|
|
|
|
using Microsoft.Extensions.DependencyInjection; |
|
|
using Shouldly; |
|
|
using Shouldly; |
|
|
|
|
|
using Volo.Abp; |
|
|
using Volo.Abp.AutoMapper; |
|
|
using Volo.Abp.AutoMapper; |
|
|
using Volo.Abp.Data; |
|
|
using Volo.Abp.Data; |
|
|
using Volo.Abp.ObjectExtending.TestObjects; |
|
|
using Volo.Abp.ObjectExtending.TestObjects; |
|
|
@ -64,4 +66,19 @@ public class AbpAutoMapperExtensibleDtoExtensions_Tests : AbpIntegratedTest<Auto |
|
|
personDto.HasProperty("IsActive").ShouldBe(false); |
|
|
personDto.HasProperty("IsActive").ShouldBe(false); |
|
|
personDto.IsActive.ShouldBe(true); |
|
|
personDto.IsActive.ShouldBe(true); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
[Fact] |
|
|
|
|
|
public void MapExtraPropertiesTo_Should_Ignored_If_ExtraProperties_Is_Null() |
|
|
|
|
|
{ |
|
|
|
|
|
var person = new ExtensibleTestPerson(); |
|
|
|
|
|
person.SetExtraPropertiesAsNull(); |
|
|
|
|
|
|
|
|
|
|
|
var personDto = new ExtensibleTestPersonDto(); |
|
|
|
|
|
personDto.SetExtraPropertiesAsNull(); |
|
|
|
|
|
|
|
|
|
|
|
Should.NotThrow(() => _objectMapper.Map(person, personDto)); |
|
|
|
|
|
|
|
|
|
|
|
person.ExtraProperties.ShouldBe(null); |
|
|
|
|
|
personDto.ExtraProperties.ShouldBeEmpty(); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
@ -12,6 +12,11 @@ public class ExtensibleTestPerson : ExtensibleObject |
|
|
{ |
|
|
{ |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void SetExtraPropertiesAsNull() |
|
|
|
|
|
{ |
|
|
|
|
|
ExtraProperties = null; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public enum ExtensibleTestEnumProperty |
|
|
public enum ExtensibleTestEnumProperty |
|
|
|
|
|
@ -2,5 +2,8 @@ |
|
|
|
|
|
|
|
|
public class ExtensibleTestPersonDto : ExtensibleObject |
|
|
public class ExtensibleTestPersonDto : ExtensibleObject |
|
|
{ |
|
|
{ |
|
|
|
|
|
public void SetExtraPropertiesAsNull() |
|
|
|
|
|
{ |
|
|
|
|
|
ExtraProperties = null; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|