File tree Expand file tree Collapse file tree 3 files changed +8
-8
lines changed Expand file tree Collapse file tree 3 files changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -81,7 +81,7 @@ public Conventions(ITypeNameSerializer typeNameSerializer)
81
81
82
82
private QueueAttribute GetQueueAttribute ( Type messageType )
83
83
{
84
- return messageType . GetAttribute < QueueAttribute > ( ) ?? new QueueAttribute ( string . Empty ) ;
84
+ return messageType . GetAttribute < QueueAttribute > ( ) ?? QueueAttribute . Default ;
85
85
}
86
86
87
87
public ExchangeNameConvention ExchangeNamingConvention { get ; set ; }
@@ -97,4 +97,4 @@ private QueueAttribute GetQueueAttribute(Type messageType)
97
97
98
98
public ConsumerTagConvention ConsumerTagConvention { get ; set ; }
99
99
}
100
- }
100
+ }
Original file line number Diff line number Diff line change @@ -5,12 +5,15 @@ namespace EasyNetQ
5
5
[ AttributeUsage ( AttributeTargets . Class | AttributeTargets . Interface , AllowMultiple = false ) ]
6
6
public class QueueAttribute : Attribute
7
7
{
8
+ internal static readonly QueueAttribute Default = new QueueAttribute ( null ) ;
9
+
8
10
public QueueAttribute ( string queueName )
9
11
{
10
12
QueueName = queueName ?? string . Empty ;
11
13
}
12
14
13
15
public string QueueName { get ; }
16
+
14
17
public string ExchangeName { get ; set ; }
15
18
}
16
19
}
Original file line number Diff line number Diff line change 2
2
using System . Collections . Concurrent ;
3
3
using System . Collections . Generic ;
4
4
using System . Linq ;
5
- using System . Linq . Expressions ;
6
- using System . Reflection ;
7
-
8
5
9
6
namespace EasyNetQ
10
7
{
@@ -14,7 +11,7 @@ public static class ReflectionHelpers
14
11
15
12
private static Dictionary < Type , Attribute [ ] > GetOrAddTypeAttributeDictionary ( Type type )
16
13
{
17
- return typesAttributes . GetOrAdd ( type , t => t . GetTypeInfo ( ) . GetCustomAttributes ( true )
14
+ return typesAttributes . GetOrAdd ( type , t => t . GetCustomAttributes ( true )
18
15
. Cast < Attribute > ( )
19
16
. GroupBy ( attr => attr . GetType ( ) )
20
17
. ToDictionary ( group => group . Key , group => group . ToArray ( ) ) ) ;
@@ -36,7 +33,7 @@ public static TAttribute GetAttribute<TAttribute>(this Type type) where TAttribu
36
33
{
37
34
return ( TAttribute ) attributes [ 0 ] ;
38
35
}
39
- return default ( TAttribute ) ;
36
+ return default ;
40
37
}
41
38
}
42
- }
39
+ }
You can’t perform that action at this time.
0 commit comments