Exemplo n.º 1
0
        public bool ExportCsv(string fileName)
        {
            //Logger.LogTrace("RepositoryBase ExportCsv: " + GetType().FullName + "." + System.Reflection.MethodBase.GetCurrentMethod()?.Name);
            try
            {
                WriteCsvClassMap <TEntity, TClassMap> .Export(LoggerFactory, fileName, FindAll());

                return(true);
            }
            catch (Exception ex)
            {
                Logger.LogError(ex, GetType().FullName + "." + System.Reflection.MethodBase.GetCurrentMethod()?.Name + ": " + ex.Message);
            }

            return(false);
        }
Exemplo n.º 2
0
        public async ValueTask <bool> ExportCsvAsync(string fileName, CancellationToken cancellationToken = default)
        {
            //Logger.LogTrace("RepositoryBase ExportCsvAsync: " + GetType().FullName + "." + System.Reflection.MethodBase.GetCurrentMethod()?.Name);
            try
            {
                await WriteCsvClassMap <TEntity, TClassMap> .ExportAsync(LoggerFactory, fileName, FindAll())
                .ConfigureAwait(false);

                return(true);
            }
            catch (Exception ex)
            {
                Logger.LogError(ex, GetType().FullName + "." + System.Reflection.MethodBase.GetCurrentMethod()?.Name + ": " + ex.Message);
            }

            return(false);
        }
Exemplo n.º 3
0
        public void ExportCsvClassMap()
        {
            var result = WriteCsvClassMap <Dto.TestClassPrivateSetter, ClassMap.TestClassPrivateSetter> .Export(_loggerFactory, @"C:\temp\Test.csv", _list);

            Assert.NotNull(result);
        }