Skip to content

Open-source eCommerce platform for C# and ASP.NET Core 10 with MongoDB. Build multi-store shops and multi-vendor marketplaces with B2B/B2C, REST API, plugins, Vue 3 and Docker.

653 B
Raw Blame
using Grand.Business.Core.Interfaces.ExportImport;

namespace Grand.Business.Common.Services.ExportImport;

public class ExportManager<T> : IExportManager<T> where T : class
{
    private readonly IExportProvider _exportProvider;
    private readonly ISchemaProperty<T> _schemaProperty;

    public ExportManager(IExportProvider exportProvider, ISchemaProperty<T> schemaProperty)
    {
        _exportProvider = exportProvider;
        _schemaProperty = schemaProperty;
    }

    public virtual async Task<byte[]> Export(IEnumerable<T> entity)
    {
        return _exportProvider.ExportToByte(await _schemaProperty.GetProperties(), entity);
    }
}