@@ -455,15 +455,19 @@ public static IServiceCollection AddServiceDescriptor<T>(this IServiceCollection
455455 /// </summary>
456456 public static IServiceCollection AddSqlCommandRules ( this IServiceCollection @this )
457457 => @this . AddRule < SqlDataSetRequest , DataSet > ( new SqlDataSetRule ( ) )
458- . AddRule < SqlDataSetRequest , DataSet > ( new SqlDataSetRule ( ) )
459458 . AddRule < SqlDataTableRequest , DataTable > ( new SqlDataTableRule ( ) )
460459 . AddRule < SqlExecuteRequest > ( new SqlExecuteRule ( ) )
461460 . AddRule < SqlResultJsonRequest , JsonArray > ( new SqlResultJsonRule ( ) )
462461 . AddRule < SqlModelsRequest , IList < object > > ( new SqlResultsRule ( ) )
463462 . AddRule < SqlScalarRequest , object ? > ( new SqlScalarRule ( ) ) ;
464463
465464 /// <summary>
466- /// Registers all types in the specified assembly that have <see cref="ServiceLifetimeAttribute{T}"/> or <see cref="ServiceLifetimeAttribute"/>.
465+ /// Registers all types in the specified assembly that have one of:
466+ /// <list type="bullet">
467+ /// <item><c><see cref="SingletonAttribute"/></c> or <c><see cref="SingletonAttribute{T}"/></c></item>
468+ /// <item><c><see cref="ScopedAttribute"/></c> or <c><see cref="ScopedAttribute{T}"/></c></item>
469+ /// <item><c><see cref="TransientAttribute"/></c> or <c><see cref="TransientAttribute{T}"/></c></item>
470+ /// </list>
467471 /// </summary>
468472 /// <param name="fromAssembly">The assembly to register the types from.</param>
469473 public static IServiceCollection AddTypes ( this IServiceCollection @this , Assembly fromAssembly )
@@ -537,7 +541,10 @@ public static IServiceCollection AddValidationRule<REQUEST>(this IServiceCollect
537541
538542 private static ServiceDescriptor ToServiceDescriptor ( this Type @this )
539543 {
540- var attribute = @this . GetCustomAttribute < ServiceLifetimeAttribute > ( ) ! ;
544+ var attributes = @this . GetCustomAttributes < ServiceLifetimeAttribute > ( ) ;
545+ attributes . Count ( ) . ThrowIfNotEqual ( 1 ) ;
546+
547+ var attribute = attributes . First ( ) ;
541548 return attribute . Key is not null
542549 ? ServiceDescriptor . DescribeKeyed ( attribute . ServiceType ?? @this , attribute . Key , @this , attribute . ServiceLifetime )
543550 : ServiceDescriptor . Describe ( attribute . ServiceType ?? @this , @this , attribute . ServiceLifetime ) ;
0 commit comments