Aquila.CSV 2.1.4

dotnet add package Aquila.CSV --version 2.1.4
                    
NuGet\Install-Package Aquila.CSV -Version 2.1.4
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Aquila.CSV" Version="2.1.4" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Aquila.CSV" Version="2.1.4" />
                    
Directory.Packages.props
<PackageReference Include="Aquila.CSV" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Aquila.CSV --version 2.1.4
                    
#r "nuget: Aquila.CSV, 2.1.4"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Aquila.CSV@2.1.4
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Aquila.CSV&version=2.1.4
                    
Install as a Cake Addin
#tool nuget:?package=Aquila.CSV&version=2.1.4
                    
Install as a Cake Tool

Absolutely! Here's a complete README and User Documentation for your Aquila.CSV library tailored for .NET / .NET MAUI usage, including usage with SQLite, handling large CSVs, and examples.


📦 Aquila.CSV

Version: 1.1.1 Platform: .NET 6/7/8/9/10, .NET MAUI

Aquila.CSV is a lightweight, developer-friendly library for reading CSV files and mapping their contents to C# models for use with SQLite or any other data storage. It is optimized for mobile, desktop, and web projects and works seamlessly with large datasets (10k+ rows).


✨ Features

  • Read CSV files into strongly-typed rows.
  • Map CSV rows to C# models.
  • Handle missing or empty fields safely.
  • Compatible with SQLite for local storage.
  • Works on .NET MAUI (Android, iOS, Windows, MacCatalyst) and standard .NET applications.
  • Handles large datasets efficiently.

📥 Installation

Using NuGet

dotnet add package Aquila.CSV --version 1.1.1

⚠️ If your package is local:

dotnet nuget add source "E:\LocalNuget" -n LocalNuget
dotnet add package Aquila.CSV --version 1.1.1 --source LocalNuget

🛠 Usage

1. Basic Example (Console / .NET App)

using SQLite;
using Aquila.CSV.Services;

// Path to your CSV file
var csvPath = "sample.csv";

// Step 1: Read CSV into rows
var rows = CsvToSQLiteImporter.ReadCsv(csvPath);

// Step 2: Map CSV rows to records
var recordsList = CsvToSQLiteImporter.MapRowsToRecords<MyTable>(rows);

// Step 3: Insert into SQLite
using var conn = new SQLiteConnection("mydatabase.db");
conn.CreateTable<MyTable>();

// Optional: truncate table before inserting
conn.DeleteAll<MyTable>();

conn.InsertAll(recordsList);

Console.WriteLine($"Inserted {recordsList.Count} records successfully!");

2. Handling Empty Fields

CsvToSQLiteImporter safely converts empty fields:

  • Empty int → 0
  • Empty DateTime → null
  • Empty string → empty string

Example mapping:

private object ConvertSafe(string value, Type type)
{
    if (string.IsNullOrWhiteSpace(value))
    {
        if (type == typeof(int) || type == typeof(int?)) return 0;
        if (type == typeof(DateTime) || type == typeof(DateTime?)) return null;
        if (type == typeof(string)) return string.Empty;
    }

    if (type == typeof(int) || type == typeof(int?)) return int.Parse(value);
    if (type == typeof(DateTime) || type == typeof(DateTime?)) return DateTime.Parse(value, CultureInfo.InvariantCulture);
    if (type == typeof(string)) return value;

    return Convert.ChangeType(value, type);
}

3. Example Model for SQLite

using SQLite;

public class DriverDetails
{
    [PrimaryKey]
    public int DriverId { get; set; }
    public int DriverAccountId { get; set; }
    public int VendorId { get; set; }
    public string DriverName { get; set; } = string.Empty;
    public string DriverLicenseNumber { get; set; } = string.Empty;
    public int DriverStatus { get; set; }
    public DateTime? DriverCreatedAt { get; set; }
}

4. Using in MAUI for File Selection

var result = await FilePicker.Default.PickAsync(new PickOptions
{
    PickerTitle = "Select CSV file",
    FileTypes = new FilePickerFileType(new Dictionary<DevicePlatform, IEnumerable<string>>
    {
        { DevicePlatform.WinUI, new[] { ".csv" } },
        { DevicePlatform.MacCatalyst, new[] { ".csv" } },
        { DevicePlatform.iOS, new[] { "public.comma-separated-values-text" } },
        { DevicePlatform.Android, new[] { "text/comma-separated-values", "text/*" } }
    })
});

if (result != null)
{
    var rows = CsvToSQLiteImporter.ReadCsv(result.FullPath);
    var records = CsvToSQLiteImporter.MapRowsToRecords<DriverDetails>(rows);
}

⚡ Handling Large CSVs

For files with 10k+ rows:

  • Use conn.InsertAll(recordsList) in batches if needed.
  • Ensure your model types match CSV columns exactly.
  • Empty or invalid integer/date fields will default to 0 or null.

🔧 API Reference

CsvToSQLiteImporter

Method Description
ReadCsv(string path) Reads a CSV file and returns a List<string[]>.
MapRowsToRecords<T>(List<string[]> rows) Maps CSV rows to a list of objects of type T.

Notes

  • Column order in CSV should match the properties of the C# model.
  • Property names do not need to match headers — mapping is positional.
  • For MAUI, file picker handles all platforms natively.

🧩 Example: Two CSVs in MAUI

  • DriverDetails.csv → import drivers.
  • MenuItem.csv → import menu items.

XAML buttons can call:

OnImportDriverClicked();  // Imports DriverDetails
OnImportMenuClicked();    // Imports MenuItem

StatusLabel updates row count and completion messages.


⚙ Requirements

  • .NET 6 or later
  • SQLite-net-pcl
  • CsvHelper

License

MIT License — free to use in commercial and personal projects.


I can also prepare a ready-to-go PDF User Guide with screenshots and MAUI example, showing Driver CSV and Menu CSV import, progress updates, and SQLite insertion.

Do you want me to make that PDF version too?

A lightweight, cross-platform .NET 9 library for downloading CSV data via HTTP (GET/POST) and saving it securely across Android, iOS, Windows, and standard .NET environments.

Built by Aswin Sadhasivam
Company: Aquila Innovations
License: MIT


🚀 Features

  • ✅ Supports GET and POST requests
  • ✅ Custom headers support
  • ✅ Cross-platform file saving
  • ✅ .NET 9 Multi-target support
  • ✅ Android, iOS, Windows compatible
  • ✅ Structured result response
  • ✅ Progress reporting for large files
  • ✅ CancellationToken support
  • ✅ CSV Content-Type validation
  • ✅ Dependency Injection ready

📦 Supported Frameworks

  • net9.0
  • net9.0-android
  • net9.0-ios
  • net9.0-windows10.0.19041.0

📥 Installation

dotnet add package Aquila.CSV

---

## 🛠 Basic Usage

```csharp
using Aquila.CSV.Models;
using Aquila.CSV.Services;

var downloader = new AquilaCsvDownloader();

var request = new AquilaCsvRequest
{
    Url = "https://example.com/data",
    FileName = "sales_report"
};

var result = await downloader.DownloadAsync(request);

if (result.Success)
{
    Console.WriteLine($"Saved to: {result.FilePath}");
}
else
{
    Console.WriteLine($"Error: {result.ErrorMessage}");
}
```

---

## 📡 POST Example

```csharp
var content = new StringContent(
    "{\"year\":2026}",
    Encoding.UTF8,
    "application/json");

var request = new AquilaCsvRequest
{
    Url = "https://example.com/export",
    Method = HttpMethod.Post,
    Content = content,
    FileName = "export_2026"
};

var result = await downloader.DownloadAsync(request);
```

---

## 🧩 Using Dependency Injection (MAUI / ASP.NET)

### Register in Program.cs or MauiProgram.cs

```csharp
using Aquila.CSV.Extensions;

builder.Services.AddAquilaCsv();
```

### Inject into constructor

```csharp
public class MyService
{
    private readonly AquilaCsvDownloader _downloader;

    public MyService(AquilaCsvDownloader downloader)
    {
        _downloader = downloader;
    }
}
```

---

## 📊 Progress Tracking

```csharp
downloader.ProgressChanged += percent =>
{
    Console.WriteLine($"Download Progress: {percent:F2}%");
};
```

---

## 💾 File Saving Location

| Platform | Save Location     |
| -------- | ----------------- |
| Android  | AppDataDirectory  |
| iOS      | AppDataDirectory  |
| Windows  | AppDataDirectory  |
| net9.0   | Current Directory |

---

## 🛡 Error Handling

The library returns a structured result:

```csharp
public sealed class AquilaCsvResult
{
    public bool Success { get; init; }
    public string? FilePath { get; init; }
    public HttpStatusCode? StatusCode { get; init; }
    public string? ErrorMessage { get; init; }
    public long? FileSizeBytes { get; init; }
    public TimeSpan Duration { get; init; }
}
```

---

## 📄 License

MIT License
© 2026 Aquila Innovations

---

## 🌟 Future Roadmap (v2 Ideas)

- CSV → DataTable parser
- Optional CSV encryption
- Retry policies
- Background download service
- Stream-based CSV processing
- Logging integration
- Blazor compatibility

---

## 🤝 Contributing

Contributions, issues, and feature requests are welcome.

---

## 🏢 About Aquila Innovations

Aquila Innovations builds modern, scalable .NET and enterprise software solutions.

```

---

```
Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.1.4 140 2/18/2026
2.1.3 114 2/18/2026
1.1.2 119 2/18/2026
1.1.1 119 2/18/2026
1.0.2 117 2/18/2026
1.0.1 116 2/18/2026
1.0.0 122 2/17/2026