Skip to content

Commit 1f4925a

Browse files
authored
Merge c6a2e55 into a6263e4
2 parents a6263e4 + c6a2e55 commit 1f4925a

File tree

1 file changed

+79
-0
lines changed

1 file changed

+79
-0
lines changed

src/ExtendedXmlSerializer/ExtensionMethodsForImplicitTyping.cs

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,19 @@ public static IConfigurationContainer EnableImplicitTypingFromPublicNested<T>(
5454
this IConfigurationContainer @this)
5555
=> @this.EnableImplicitTyping(new PublicNestedTypes<T>());
5656

57+
/// <summary>
58+
/// Convenience method to enable implicit typing on a container, using all public-nested types found within the
59+
/// provided subject type. All public nested types found within the provided subject type will be included as an
60+
/// implicit type.
61+
/// </summary>
62+
/// <param name="this">The configuration container to configure.</param>
63+
/// <param name="type">The subject type to query for type resolution.</param>
64+
/// <returns>The configured configuration container.</returns>
65+
/// <seealso cref="EnableImplicitTyping(IConfigurationContainer,System.Type[])"/>
66+
public static IConfigurationContainer EnableImplicitTypingFromPublicNested(
67+
this IConfigurationContainer @this, Type type)
68+
=> @this.EnableImplicitTyping(new PublicNestedTypes(type));
69+
5770
/// <summary>
5871
/// Convenience method to enable implicit typing on a container, using all nested types -- private or otherwise --
5972
/// found within the provided subject type. All nested types found within the provided subject type will be
@@ -66,6 +79,19 @@ public static IConfigurationContainer EnableImplicitTypingFromPublicNested<T>(
6679
public static IConfigurationContainer EnableImplicitTypingFromNested<T>(this IConfigurationContainer @this)
6780
=> @this.EnableImplicitTyping(new NestedTypes<T>());
6881

82+
/// <summary>
83+
/// Convenience method to enable implicit typing on a container, using all nested types -- private or otherwise --
84+
/// found within the provided subject type. All nested types found within the provided subject type will be
85+
/// included and registered as an implicit type.
86+
/// </summary>
87+
/// <param name="this">The configuration container to configure.</param>
88+
/// <param name="type">The subject type to query for type resolution.</param>
89+
/// <returns>The configured configuration container.</returns>
90+
/// <seealso cref="EnableImplicitTyping(IConfigurationContainer,System.Type[])"/>
91+
public static IConfigurationContainer EnableImplicitTypingFromNested(this IConfigurationContainer @this, Type type)
92+
=> @this.EnableImplicitTyping(new NestedTypes(type));
93+
94+
6995
/// <summary>
7096
/// Convenience method to enable implicit typing on a container, using all found types within the provided subject
7197
/// type's assembly. All types found within the provided subject type's assembly will be included and registered as
@@ -79,6 +105,19 @@ public static IConfigurationContainer EnableImplicitTypingFromNested<T>(this ICo
79105
public static IConfigurationContainer EnableImplicitTypingFromAll<T>(this IConfigurationContainer @this)
80106
=> @this.EnableImplicitTyping(new AllAssemblyTypes<T>());
81107

108+
/// <summary>
109+
/// Convenience method to enable implicit typing on a container, using all found types within the provided subject
110+
/// type's assembly. All types found within the provided subject type's assembly will be included and registered as
111+
/// an implicit type. Use this with care and ensure that the names of all the types found within the assembly are
112+
/// unique. Otherwise, an exception will be thrown if more than one type share the same name.
113+
/// </summary>
114+
/// <param name="this">The configuration container to configure.</param>
115+
/// <param name="type">The subject type to query for type resolution.</param>
116+
/// <returns>The configured configuration container.</returns>
117+
/// <seealso cref="EnableImplicitTyping(IConfigurationContainer,System.Type[])"/>
118+
public static IConfigurationContainer EnableImplicitTypingFromAll(this IConfigurationContainer @this, Type type)
119+
=> @this.EnableImplicitTyping(new AllAssemblyTypes(type));
120+
82121
/// <summary>
83122
/// Convenience method to enable implicit typing on a container, using all found public types within the provided
84123
/// subject type's assembly. All public types found within the provided subject type's assembly will be included and
@@ -92,6 +131,19 @@ public static IConfigurationContainer EnableImplicitTypingFromAll<T>(this IConfi
92131
public static IConfigurationContainer EnableImplicitTypingFromPublic<T>(this IConfigurationContainer @this)
93132
=> @this.EnableImplicitTyping(new PublicAssemblyTypes<T>());
94133

134+
/// <summary>
135+
/// Convenience method to enable implicit typing on a container, using all found public types within the provided
136+
/// subject type's assembly. All public types found within the provided subject type's assembly will be included and
137+
/// registered as an implicit type. Use this with care and ensure that the names of all the public types found within
138+
/// the assembly are unique. Otherwise, an exception will be thrown if more than one type share the same name.
139+
/// </summary>
140+
/// <param name="this">The configuration container to configure.</param>
141+
/// <param name="type">The subject type to query for type resolution.</param>
142+
/// <returns>The configured configuration container.</returns>
143+
/// <seealso cref="EnableImplicitTyping(IConfigurationContainer,System.Type[])"/>
144+
public static IConfigurationContainer EnableImplicitTypingFromPublic(this IConfigurationContainer @this, Type type)
145+
=> @this.EnableImplicitTyping(new PublicAssemblyTypes(type));
146+
95147
/// <summary>
96148
/// Convenience method to enable implicit typing on a container, using all found types within the provided subject
97149
/// type's namespace. All types found within the provided subject type's namespace will be included and registered as
@@ -105,6 +157,19 @@ public static IConfigurationContainer EnableImplicitTypingFromPublic<T>(this ICo
105157
public static IConfigurationContainer EnableImplicitTypingFromNamespace<T>(this IConfigurationContainer @this)
106158
=> @this.EnableImplicitTyping(new AllTypesInSameNamespace<T>());
107159

160+
/// <summary>
161+
/// Convenience method to enable implicit typing on a container, using all found types within the provided subject
162+
/// type's namespace. All types found within the provided subject type's namespace will be included and registered as
163+
/// an implicit type. Use this with care and ensure that the names of all the types found within the namespace are
164+
/// unique. Otherwise, an exception will be thrown if more than one type share the same name.
165+
/// </summary>
166+
/// <param name="this">The configuration container to configure.</param>
167+
/// <param name="type">The subject type to query for type resolution.</param>
168+
/// <returns>The configured configuration container.</returns>
169+
/// <seealso cref="EnableImplicitTyping(IConfigurationContainer,System.Type[])"/>
170+
public static IConfigurationContainer EnableImplicitTypingFromNamespace(this IConfigurationContainer @this, Type type)
171+
=> @this.EnableImplicitTyping(new AllTypesInSameNamespace(type));
172+
108173
/// <summary>
109174
/// Convenience method to enable implicit typing on a container, using all found public types within the provided
110175
/// subject type's namespace. All public types found within the provided subject type's namespace will be included and
@@ -118,5 +183,19 @@ public static IConfigurationContainer EnableImplicitTypingFromNamespace<T>(this
118183
public static IConfigurationContainer EnableImplicitTypingFromNamespacePublic<T>(
119184
this IConfigurationContainer @this)
120185
=> @this.EnableImplicitTyping(new PublicTypesInSameNamespace<T>());
186+
187+
/// <summary>
188+
/// Convenience method to enable implicit typing on a container, using all found public types within the provided
189+
/// subject type's namespace. All public types found within the provided subject type's namespace will be included and
190+
/// registered as an implicit type. Use this with care and ensure that the names of all the public types found within
191+
/// the namespace are unique. Otherwise, an exception will be thrown if more than one type share the same name.
192+
/// </summary>
193+
/// <param name="this">The configuration container to configure.</param>
194+
/// <param name="type">The subject type to query for type resolution.</param>
195+
/// <returns>The configured configuration container.</returns>
196+
/// <seealso cref="EnableImplicitTyping(IConfigurationContainer,System.Type[])"/>
197+
public static IConfigurationContainer EnableImplicitTypingFromNamespacePublic(
198+
this IConfigurationContainer @this, Type type)
199+
=> @this.EnableImplicitTyping(new PublicTypesInSameNamespace(type));
121200
}
122201
}

0 commit comments

Comments
 (0)