| | | 1 | | // ----------------------------------------------------------------------- |
| | | 2 | | // <copyright file="ServiceCollectionExtensions.cs" company="Stéphane ANDRE"> |
| | | 3 | | // Copyright (c) Stéphane ANDRE. All rights reserved. |
| | | 4 | | // </copyright> |
| | | 5 | | // ----------------------------------------------------------------------- |
| | | 6 | | |
| | | 7 | | using Microsoft.Extensions.DependencyInjection; |
| | | 8 | | using Microsoft.Extensions.DependencyInjection.Extensions; |
| | | 9 | | |
| | | 10 | | #pragma warning disable IDE0130 // Namespace does not match folder structure |
| | | 11 | | namespace MyNet.Mail.MailKit; |
| | | 12 | | #pragma warning restore IDE0130 // Namespace does not match folder structure |
| | | 13 | | |
| | | 14 | | /// <summary> |
| | | 15 | | /// Dependency injection extensions for MailKit mail services. |
| | | 16 | | /// </summary> |
| | | 17 | | public static class ServiceCollectionExtensions |
| | | 18 | | { |
| | | 19 | | extension(IServiceCollection services) |
| | | 20 | | { |
| | | 21 | | /// <summary> |
| | | 22 | | /// Registers <see cref="MailKitServiceFactory"/> as <see cref="IMailServiceFactory"/>. |
| | | 23 | | /// </summary> |
| | | 24 | | public IServiceCollection AddMailKitMailService() |
| | | 25 | | { |
| | 3 | 26 | | services.TryAddSingleton<IMailServiceFactory, MailKitServiceFactory>(); |
| | 3 | 27 | | return services; |
| | | 28 | | } |
| | | 29 | | } |
| | | 30 | | } |
| | | 31 | | |