Skip to content

Commit 2e0f58e

Browse files
committed
[Host.AzureServiceBus] Create topic/queue dynamically when path param uses a non-default value
Signed-off-by: Tomasz Maruszak <[email protected]>
1 parent f86b034 commit 2e0f58e

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

src/Host.Plugin.Properties.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<Import Project="Common.NuGet.Properties.xml" />
55

66
<PropertyGroup>
7-
<Version>3.3.1-rc101</Version>
7+
<Version>3.3.1-rc102</Version>
88
</PropertyGroup>
99

1010
</Project>

src/SlimMessageBus.Host/Collections/RuntimeTypeCache.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,14 @@ public RuntimeTypeCache()
2525
_closedGenericTypeOfOpenGenericType = new SafeDictionaryWrapper<(Type OpenGenericType, Type GenericPatameterType), Type>(x => x.OpenGenericType.MakeGenericType(x.GenericPatameterType));
2626
_collectionInfoByType = new SafeDictionaryWrapper<Type, CollectionTypeInfo>(type =>
2727
{
28-
var enumerableType = type.GetInterfaces().Concat([type])
28+
var types = type.GetInterfaces().Concat([type]).ToHashSet();
29+
if (types.Any(x => x.IsGenericType && x.GetGenericTypeDefinition() == typeof(IDictionary<,>)))
30+
{
31+
// IDictionary<K, V> types should not be treated as collections.
32+
return null;
33+
}
34+
35+
var enumerableType = types
2936
.SingleOrDefault(x => x.IsGenericType && x.GetGenericTypeDefinition() == typeof(IEnumerable<>));
3037

3138
if (enumerableType != null)

src/Tests/SlimMessageBus.Host.Test/Collections/RuntimeTypeCacheTests.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,12 @@ public void When_GetClosedGenericType(Type openGenericType, Type genericParamete
8585
{ new SomeMessage[] { new(), new() }, true},
8686
{ new HashSet<SomeMessage> { new(), new() }, true },
8787
{ new object(), false },
88+
{ new Dictionary<string, object>(), false },
8889
};
8990

9091
[Theory]
9192
[MemberData(nameof(Data))]
92-
public void Given_ObjectThatIsCollection_When_Then(object collection, bool isCollection)
93+
public void Given_ObjectThatIsCollection_When_GetCollectionTypeInfo_Then_ReturnsCollectionInfo(object collection, bool isCollection)
9394
{
9495
// arrange
9596

0 commit comments

Comments
 (0)