@@ -50,25 +50,16 @@ [NotNull] Type type
5050 return architecture . GetInterfaceOfType ( type ) ;
5151 }
5252
53- try
53+ var foundType = AllTypes ( architecture )
54+ . WhereAssemblyQualifiedNameIs ( type . AssemblyQualifiedName ) ;
55+ if ( foundType != null )
5456 {
55- var foundType = AllTypes ( architecture ) . WhereFullNameIs ( type . FullName ) ;
56- if ( foundType != null )
57- {
58- return foundType ;
59- }
60-
61- throw new TypeDoesNotExistInArchitecture (
62- $ "Type { type . FullName } does not exist in provided architecture."
63- ) ;
64- }
65- catch ( MultipleOccurrencesInSequenceException )
66- {
67- throw new NotSupportedException (
68- $ "Type { type . FullName } found multiple times in provided architecture. Please use extern "
69- + "alias to reference assemblies that have the same fully-qualified type names."
70- ) ;
57+ return foundType ;
7158 }
59+
60+ throw new TypeDoesNotExistInArchitecture (
61+ $ "Type { type . FullName } does not exist in provided architecture."
62+ ) ;
7263 }
7364
7465 [ NotNull ]
@@ -77,25 +68,16 @@ public static Class GetClassOfType(
7768 [ NotNull ] Type type
7869 )
7970 {
80- try
71+ var cls = AllClasses ( architecture )
72+ . WhereAssemblyQualifiedNameIs ( type . AssemblyQualifiedName ) ;
73+ if ( cls != null )
8174 {
82- var cls = AllClasses ( architecture ) . WhereFullNameIs ( type . FullName ) ;
83- if ( cls != null )
84- {
85- return cls ;
86- }
87-
88- throw new TypeDoesNotExistInArchitecture (
89- $ "Type { type . FullName } does not exist in provided architecture or is no class."
90- ) ;
91- }
92- catch ( MultipleOccurrencesInSequenceException )
93- {
94- throw new NotSupportedException (
95- $ "Type { type . FullName } found multiple times in provided architecture. Please use extern "
96- + "alias to reference assemblies that have the same fully-qualified type names."
97- ) ;
75+ return cls ;
9876 }
77+
78+ throw new TypeDoesNotExistInArchitecture (
79+ $ "Type { type . FullName } does not exist in provided architecture or is no class."
80+ ) ;
9981 }
10082
10183 [ NotNull ]
@@ -104,25 +86,16 @@ public static Interface GetInterfaceOfType(
10486 [ NotNull ] Type type
10587 )
10688 {
107- try
89+ var intf = AllInterfaces ( architecture )
90+ . WhereAssemblyQualifiedNameIs ( type . AssemblyQualifiedName ) ;
91+ if ( intf != null )
10892 {
109- var intf = AllInterfaces ( architecture ) . WhereFullNameIs ( type . FullName ) ;
110- if ( intf != null )
111- {
112- return intf ;
113- }
114-
115- throw new TypeDoesNotExistInArchitecture (
116- $ "Type { type . FullName } does not exist in provided architecture or is no interface."
117- ) ;
118- }
119- catch ( MultipleOccurrencesInSequenceException )
120- {
121- throw new NotSupportedException (
122- $ "Type { type . FullName } found multiple times in provided architecture. Please use extern "
123- + "alias to reference assemblies that have the same fully-qualified type names."
124- ) ;
93+ return intf ;
12594 }
95+
96+ throw new TypeDoesNotExistInArchitecture (
97+ $ "Type { type . FullName } does not exist in provided architecture or is no interface."
98+ ) ;
12699 }
127100
128101 [ NotNull ]
@@ -131,25 +104,16 @@ public static Attribute GetAttributeOfType(
131104 [ NotNull ] Type type
132105 )
133106 {
134- try
107+ var attribute = AllAttributes ( architecture )
108+ . WhereAssemblyQualifiedNameIs ( type . AssemblyQualifiedName ) ;
109+ if ( attribute != null )
135110 {
136- var attribute = AllAttributes ( architecture ) . WhereFullNameIs ( type . FullName ) ;
137- if ( attribute != null )
138- {
139- return attribute ;
140- }
141-
142- throw new TypeDoesNotExistInArchitecture (
143- $ "Type { type . FullName } does not exist in provided architecture or is no attribute."
144- ) ;
145- }
146- catch ( MultipleOccurrencesInSequenceException )
147- {
148- throw new NotSupportedException (
149- $ "Type { type . FullName } found multiple times in provided architecture. Please use extern "
150- + "alias to reference assemblies that have the same fully-qualified type names."
151- ) ;
111+ return attribute ;
152112 }
113+
114+ throw new TypeDoesNotExistInArchitecture (
115+ $ "Type { type . FullName } does not exist in provided architecture or is no attribute."
116+ ) ;
153117 }
154118
155119 [ NotNull ]
0 commit comments