﻿{{! Copyright (c) Avanade. Licensed under the MIT License. See https://github.com/Avanade/Beef }}
/*
 * This file is automatically generated; any changes will be lost. 
 */

#nullable enable
#pragma warning disable

using Beef.Data.Database;
using Microsoft.Extensions.DependencyInjection;
using System.Collections.Generic;
using System.Data;

namespace {{NamespaceBusiness}}.Data
{
    /// <summary>
    /// Provides the <see cref="DatabaseEventOutboxBase.EnqueueAsync(IDatabase, IEnumerable{DatabaseEventOutboxItem})">enqueue</see> and 
    /// <see cref="DatabaseEventOutboxBase.DequeueAsync(IDatabase, int)">dequeue</see> of <see cref="DatabaseEventOutboxItem"/>(s).
    /// </summary>
    public class DatabaseEventOutbox : DatabaseEventOutboxBase
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="DatabaseEventOutbox"/> class.
        /// </summary>
        public DatabaseEventOutbox() : base("[{{Schema}}].[sp{{EventOutboxTableName}}Enqueue]", "[{{Schema}}].[sp{{EventOutboxTableName}}Dequeue]", "[{{Schema}}].[udt{{EventOutboxTableName}}List]") { }
    }

    /// <summary>
    /// Provides the <see cref="DatabaseEventOutbox"/> data mapper extension methods.
    /// </summary>
    public static class DatabaseEventOutboxExtensions
    {
        /// <summary>
        /// Adds the generated <see cref="DatabaseEventOutbox"/> as a singleton service.
        /// </summary>
        /// <param name="services">The <see cref="IServiceCollection"/>.</param>
        /// <returns>The <see cref="IServiceCollection"/>.</returns>
        public static IServiceCollection AddGeneratedDatabaseEventOutbox(this IServiceCollection services) => services.AddSingleton<DatabaseEventOutboxBase>(new DatabaseEventOutbox());
    }
}

#pragma warning restore
#nullable restore