using System.Data; using Bit.Core.Tools.Entities; namespace Bit.Infrastructure.Dapper.Tools.Helpers; /// /// Dapper helper methods for Sends /// public static class SendHelpers { private static readonly DataTableBuilder _sendTableBuilder = new( [ s => s.Id, s => s.UserId, s => s.OrganizationId, s => s.Type, s => s.Data, s => s.Key, s => s.Password, s => s.MaxAccessCount, s => s.AccessCount, s => s.CreationDate, s => s.RevisionDate, s => s.ExpirationDate, s => s.DeletionDate, s => s.Disabled, s => s.HideEmail, ] ); /// /// Converts an IEnumerable of Sends to a DataTable /// /// Contains a hardcoded list of properties and must be updated with model /// List of sends /// A data table matching the schema of dbo.Send containing one row mapped from the items in s public static DataTable ToDataTable(this IEnumerable sends) { return _sendTableBuilder.Build(sends ?? []); } }