CsvReaderAdvanced 1.0.4
See the version list below for details.
dotnet add package CsvReaderAdvanced --version 1.0.4
NuGet\Install-Package CsvReaderAdvanced -Version 1.0.4
<PackageReference Include="CsvReaderAdvanced" Version="1.0.4" />
<PackageVersion Include="CsvReaderAdvanced" Version="1.0.4" />
<PackageReference Include="CsvReaderAdvanced" />
paket add CsvReaderAdvanced --version 1.0.4
#r "nuget: CsvReaderAdvanced, 1.0.4"
#:package CsvReaderAdvanced@1.0.4
#addin nuget:?package=CsvReaderAdvanced&version=1.0.4
#tool nuget:?package=CsvReaderAdvanced&version=1.0.4
CsvReaderAdvanced
The faster and most modern CSV reader adapted to DI principles.
How to use
First add the service to the ServiceCollection.
builder.ConfigureServices((context, services) =>
{
services.AddCsvReader(context.Configuration);
...
To understand exactly what the method does, it assumes that the current configuration file contains a csvSchemas
section, typically in the appsettings.json
file:
public static IServiceCollection AddCsvReader(this IServiceCollection services, IConfiguration configuration)
{
services.AddSingleton<ICsvReader,CsvReader>();
services.AddTransient<ICsvFile,CsvFile>();
//Microsoft.Extensions.Hosting must be referenced
services.Configure<CsvSchemaOptions>(configuration.GetSection(CsvSchemaOptions.CsvSchemasSection));
return services;
}
The schema in the appsettings.json file typically contains a property named csvSchemas
:
"csvSchemas": {
"schemas": [
{
"name": "shipments",
"fields": [
{
"name": "ClientShipmentID",
"alternatives": [ "Client Shipment ID", "Client shipmentid" ],
"required": true
},
{
"name": "Weight",
"unit": "t",
"alternativeFields": [ "Volume", "TEU" ],
"required": true
},
{
"name": "Volume",
"unit": "m^3",
"alternativeUnits": [ "m3", "m^3", "m�" ]
...
We assume that we get the options via DI like the following example:
public Importer(
IUnitOfWork context,
IMapper mapper,
IServiceProvider provider,
ILogger logger,
IOptions<CsvSchemaOptions> options)
{
_context = context;
_mapper = mapper;
_provider = provider;
_logger = logger;
_options = options.Value;
}
protected readonly IUnitOfWork _context;
protected readonly IMapper _mapper;
protected readonly IServiceProvider _provider;
protected readonly ILogger _logger;
protected readonly CsvSchemaOptions _options;
public CsvSchema? GetSchema(string name) =>
_options?.Schemas?.FirstOrDefault(s => s.Name == name);
public ValidationResult CheckForSchema(string name)
{
if (_options?.Schemas is null || !_options.Schemas.Any())
{
_logger.LogError("Could not retrieve csv schemas from settings");
return new ValidationResult(
new ValidationFailure[] { new ValidationFailure("CsvSchemas", "Cannot retrieve csv schemas from settings") });
}
var schema = GetSchema(name);
if (schema is null)
{
_logger.LogError("Could not retrieve '{schemaName}' schema from settings",name);
return new ValidationResult(
new ValidationFailure[] { new ValidationFailure("clientSites", $"Cannot retrieve '{name}' schema from settings") });
}
return new ValidationResult();
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net7.0
- Microsoft.Extensions.Hosting (>= 7.0.1)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on CsvReaderAdvanced:
Package | Downloads |
---|---|
EndpointProviders
A modern way to add Dependency Injection used for Minimal API apps. See README. |
|
SqlServerExplorerLib
The easiest way to perform SQL Server operations, such as viewing table fields, copying table data to a file, or transferring table data between databases. See the README for more information. |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last Updated | |
---|---|---|---|
2.6.0 | 213 | 2/23/2025 | |
2.5.0 | 139 | 1/17/2025 | |
2.4.1 | 116 | 12/27/2024 | |
2.4.0 | 296 | 11/15/2024 | |
2.3.8 | 274 | 10/16/2024 | |
2.3.7 | 190 | 7/27/2024 | |
2.3.6 | 140 | 7/27/2024 | |
2.3.5 | 120 | 7/26/2024 | |
2.3.4 | 140 | 7/12/2024 | |
2.3.3 | 160 | 6/22/2024 | |
2.3.2 | 158 | 6/22/2024 | |
2.3.1 | 604 | 3/1/2024 | |
2.3.0 | 273 | 12/13/2023 | |
2.2.1 | 178 | 11/28/2023 | |
2.2.0 | 215 | 10/17/2023 | |
2.1.1 | 181 | 10/15/2023 | |
2.1.0 | 167 | 10/15/2023 | |
1.3.3 | 168 | 10/14/2023 | |
1.3.2 | 161 | 10/14/2023 | |
1.3.0 | 176 | 10/13/2023 | |
1.2.6 | 179 | 9/29/2023 | |
1.2.5 | 257 | 7/18/2023 | |
1.2.4 | 258 | 7/16/2023 | |
1.2.2 | 228 | 7/16/2023 | |
1.2.1 | 224 | 7/14/2023 | |
1.2.0 | 218 | 7/14/2023 | |
1.1.15 | 233 | 7/14/2023 | |
1.1.14 | 223 | 7/14/2023 | |
1.1.13 | 233 | 7/7/2023 | |
1.1.12 | 334 | 7/6/2023 | |
1.1.11 | 213 | 7/5/2023 | |
1.1.10 | 239 | 7/5/2023 | |
1.1.9 | 213 | 6/27/2023 | |
1.1.8 | 200 | 6/26/2023 | |
1.1.7 | 201 | 6/24/2023 | |
1.1.6 | 207 | 6/24/2023 | |
1.1.5 | 209 | 6/23/2023 | |
1.1.2 | 217 | 6/23/2023 | |
1.0.28 | 220 | 6/23/2023 | |
1.0.27 | 224 | 6/23/2023 | |
1.0.26 | 196 | 6/19/2023 | |
1.0.25 | 234 | 6/18/2023 | |
1.0.24 | 199 | 6/18/2023 | |
1.0.23 | 230 | 6/18/2023 | |
1.0.22 | 218 | 6/18/2023 | |
1.0.21 | 224 | 6/17/2023 | |
1.0.20 | 219 | 6/17/2023 | |
1.0.19 | 211 | 6/17/2023 | |
1.0.18 | 211 | 6/17/2023 | |
1.0.17 | 240 | 6/17/2023 | |
1.0.16 | 209 | 6/17/2023 | |
1.0.15 | 218 | 6/17/2023 | |
1.0.12 | 203 | 6/17/2023 | |
1.0.11 | 225 | 6/17/2023 | |
1.0.10 | 196 | 6/17/2023 | |
1.0.9 | 220 | 6/17/2023 | |
1.0.8 | 221 | 6/17/2023 | |
1.0.7 | 215 | 6/17/2023 | |
1.0.6 | 215 | 6/16/2023 | |
1.0.5 | 230 | 6/16/2023 | |
1.0.4 | 241 | 6/16/2023 | |
1.0.2 | 237 | 6/16/2023 |