Skip to content

Commit

Permalink
Merge c6a2e55 into a6263e4
Browse files Browse the repository at this point in the history
  • Loading branch information
onetocny authored Dec 10, 2020
2 parents a6263e4 + c6a2e55 commit 1f4925a
Showing 1 changed file with 79 additions and 0 deletions.
79 changes: 79 additions & 0 deletions src/ExtendedXmlSerializer/ExtensionMethodsForImplicitTyping.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,19 @@ public static IConfigurationContainer EnableImplicitTypingFromPublicNested<T>(
this IConfigurationContainer @this)
=> @this.EnableImplicitTyping(new PublicNestedTypes<T>());

/// <summary>
/// Convenience method to enable implicit typing on a container, using all public-nested types found within the
/// provided subject type. All public nested types found within the provided subject type will be included as an
/// implicit type.
/// </summary>
/// <param name="this">The configuration container to configure.</param>
/// <param name="type">The subject type to query for type resolution.</param>
/// <returns>The configured configuration container.</returns>
/// <seealso cref="EnableImplicitTyping(IConfigurationContainer,System.Type[])"/>
public static IConfigurationContainer EnableImplicitTypingFromPublicNested(
this IConfigurationContainer @this, Type type)
=> @this.EnableImplicitTyping(new PublicNestedTypes(type));

/// <summary>
/// Convenience method to enable implicit typing on a container, using all nested types -- private or otherwise --
/// found within the provided subject type. All nested types found within the provided subject type will be
Expand All @@ -66,6 +79,19 @@ public static IConfigurationContainer EnableImplicitTypingFromPublicNested<T>(
public static IConfigurationContainer EnableImplicitTypingFromNested<T>(this IConfigurationContainer @this)
=> @this.EnableImplicitTyping(new NestedTypes<T>());

/// <summary>
/// Convenience method to enable implicit typing on a container, using all nested types -- private or otherwise --
/// found within the provided subject type. All nested types found within the provided subject type will be
/// included and registered as an implicit type.
/// </summary>
/// <param name="this">The configuration container to configure.</param>
/// <param name="type">The subject type to query for type resolution.</param>
/// <returns>The configured configuration container.</returns>
/// <seealso cref="EnableImplicitTyping(IConfigurationContainer,System.Type[])"/>
public static IConfigurationContainer EnableImplicitTypingFromNested(this IConfigurationContainer @this, Type type)
=> @this.EnableImplicitTyping(new NestedTypes(type));


/// <summary>
/// Convenience method to enable implicit typing on a container, using all found types within the provided subject
/// type's assembly. All types found within the provided subject type's assembly will be included and registered as
Expand All @@ -79,6 +105,19 @@ public static IConfigurationContainer EnableImplicitTypingFromNested<T>(this ICo
public static IConfigurationContainer EnableImplicitTypingFromAll<T>(this IConfigurationContainer @this)
=> @this.EnableImplicitTyping(new AllAssemblyTypes<T>());

/// <summary>
/// Convenience method to enable implicit typing on a container, using all found types within the provided subject
/// type's assembly. All types found within the provided subject type's assembly will be included and registered as
/// an implicit type. Use this with care and ensure that the names of all the types found within the assembly are
/// unique. Otherwise, an exception will be thrown if more than one type share the same name.
/// </summary>
/// <param name="this">The configuration container to configure.</param>
/// <param name="type">The subject type to query for type resolution.</param>
/// <returns>The configured configuration container.</returns>
/// <seealso cref="EnableImplicitTyping(IConfigurationContainer,System.Type[])"/>
public static IConfigurationContainer EnableImplicitTypingFromAll(this IConfigurationContainer @this, Type type)
=> @this.EnableImplicitTyping(new AllAssemblyTypes(type));

/// <summary>
/// Convenience method to enable implicit typing on a container, using all found public types within the provided
/// subject type's assembly. All public types found within the provided subject type's assembly will be included and
Expand All @@ -92,6 +131,19 @@ public static IConfigurationContainer EnableImplicitTypingFromAll<T>(this IConfi
public static IConfigurationContainer EnableImplicitTypingFromPublic<T>(this IConfigurationContainer @this)
=> @this.EnableImplicitTyping(new PublicAssemblyTypes<T>());

/// <summary>
/// Convenience method to enable implicit typing on a container, using all found public types within the provided
/// subject type's assembly. All public types found within the provided subject type's assembly will be included and
/// registered as an implicit type. Use this with care and ensure that the names of all the public types found within
/// the assembly are unique. Otherwise, an exception will be thrown if more than one type share the same name.
/// </summary>
/// <param name="this">The configuration container to configure.</param>
/// <param name="type">The subject type to query for type resolution.</param>
/// <returns>The configured configuration container.</returns>
/// <seealso cref="EnableImplicitTyping(IConfigurationContainer,System.Type[])"/>
public static IConfigurationContainer EnableImplicitTypingFromPublic(this IConfigurationContainer @this, Type type)
=> @this.EnableImplicitTyping(new PublicAssemblyTypes(type));

/// <summary>
/// Convenience method to enable implicit typing on a container, using all found types within the provided subject
/// type's namespace. All types found within the provided subject type's namespace will be included and registered as
Expand All @@ -105,6 +157,19 @@ public static IConfigurationContainer EnableImplicitTypingFromPublic<T>(this ICo
public static IConfigurationContainer EnableImplicitTypingFromNamespace<T>(this IConfigurationContainer @this)
=> @this.EnableImplicitTyping(new AllTypesInSameNamespace<T>());

/// <summary>
/// Convenience method to enable implicit typing on a container, using all found types within the provided subject
/// type's namespace. All types found within the provided subject type's namespace will be included and registered as
/// an implicit type. Use this with care and ensure that the names of all the types found within the namespace are
/// unique. Otherwise, an exception will be thrown if more than one type share the same name.
/// </summary>
/// <param name="this">The configuration container to configure.</param>
/// <param name="type">The subject type to query for type resolution.</param>
/// <returns>The configured configuration container.</returns>
/// <seealso cref="EnableImplicitTyping(IConfigurationContainer,System.Type[])"/>
public static IConfigurationContainer EnableImplicitTypingFromNamespace(this IConfigurationContainer @this, Type type)
=> @this.EnableImplicitTyping(new AllTypesInSameNamespace(type));

/// <summary>
/// Convenience method to enable implicit typing on a container, using all found public types within the provided
/// subject type's namespace. All public types found within the provided subject type's namespace will be included and
Expand All @@ -118,5 +183,19 @@ public static IConfigurationContainer EnableImplicitTypingFromNamespace<T>(this
public static IConfigurationContainer EnableImplicitTypingFromNamespacePublic<T>(
this IConfigurationContainer @this)
=> @this.EnableImplicitTyping(new PublicTypesInSameNamespace<T>());

/// <summary>
/// Convenience method to enable implicit typing on a container, using all found public types within the provided
/// subject type's namespace. All public types found within the provided subject type's namespace will be included and
/// registered as an implicit type. Use this with care and ensure that the names of all the public types found within
/// the namespace are unique. Otherwise, an exception will be thrown if more than one type share the same name.
/// </summary>
/// <param name="this">The configuration container to configure.</param>
/// <param name="type">The subject type to query for type resolution.</param>
/// <returns>The configured configuration container.</returns>
/// <seealso cref="EnableImplicitTyping(IConfigurationContainer,System.Type[])"/>
public static IConfigurationContainer EnableImplicitTypingFromNamespacePublic(
this IConfigurationContainer @this, Type type)
=> @this.EnableImplicitTyping(new PublicTypesInSameNamespace(type));
}
}

0 comments on commit 1f4925a

Please sign in to comment.