Aspireng.Data 1.1.3

dotnet add package Aspireng.Data --version 1.1.3
                    
NuGet\Install-Package Aspireng.Data -Version 1.1.3
                    
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="Aspireng.Data" Version="1.1.3" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Aspireng.Data" Version="1.1.3" />
                    
Directory.Packages.props
<PackageReference Include="Aspireng.Data" />
                    
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 Aspireng.Data --version 1.1.3
                    
#r "nuget: Aspireng.Data, 1.1.3"
                    
#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 Aspireng.Data@1.1.3
                    
#: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=Aspireng.Data&version=1.1.3
                    
Install as a Cake Addin
#tool nuget:?package=Aspireng.Data&version=1.1.3
                    
Install as a Cake Tool

Aspireng.Data

Aspireng.Data is a foundational .NET library for data access, storage abstraction, and service patterns, designed to support robust, secure, and flexible data operations. It provides a unified interface for working with SQL databases and file-based storage, along with extensible service layers, entity models, and utility extensions.

Features

  • Unified Data Store Abstraction: Easily switch between SQL and file-based storage with a common interface.
  • Service Layer Patterns: Base service classes for CRUD, caching, and business logic encapsulation.
  • Entity Models: Standardized base entities with audit/history tracking.
  • SQL Utilities: Rich static helpers for SQL Server operations, including bulk copy, scalar queries, and table exports.
  • Data Encryption: Attribute-driven, recursive encryption/decryption for sensitive fields.
  • Extensible Architecture: Designed for extension and integration with other Aspireng modules (Caching, Logging, Security, etc.).
  • Operation Results: Consistent result objects for service operations, including status, messages, and error handling.

Project Structure

Aspireng.Data/
│
├── DataStores/         # Data access abstractions and implementations
│   ├── IDataStore.cs         # Generic data store interface
│   ├── SqlDataStore.cs       # SQL Server implementation
│   └── FileDataStore.cs      # File-based implementation
│
├── Extensions/         # Utility and helper extension methods
│   ├── DataEncryptionExtensions.cs
│   ├── DataTableExtensions.cs
│   └── DataReaderExtensions.cs
│
├── Models/             # Core data models and entity definitions
│   ├── BaseEntity.cs
│   ├── ColumnInfo.cs
│   ├── TableInfo.cs
│   ├── QueryTypes.cs
│   └── History.cs
│
├── Services/           # Base service classes for business logic
│   ├── BaseService.cs
│   ├── BaseSqlService.cs
│   └── BaseServiceSingular.cs
│
├── MsSql.cs            # Static SQL Server utility class
├── Aspireng.Data.csproj
└── Aspireng.Data.sln

Key Components

DataStores

  • IDataStore<T>: Generic interface for CRUD and query operations.
  • SqlDataStore<T>: SQL Server-backed implementation, using reflection and dynamic mapping.
  • FileDataStore<T>: File-based storage using JSON serialization, with per-file concurrency control.

Models

  • BaseEntity: Abstract base for all entities, with audit fields and change history.
  • ColumnInfo / TableInfo: Metadata for dynamic table/column operations.
  • QueryTypes: Enum for query result types (Scalar, List, Pivot, Table).
  • History: Tracks changes and actions on entities.

Services

  • BaseService<T>: Generic service with caching, CRUD, and query support.
  • BaseSqlService<T>: SQL-specific service with query string support.
  • BaseServiceSingular<T>: Service for singleton-like entities.

Extensions

  • DataEncryptionExtensions: Attribute-driven, recursive encryption/decryption for entity fields.
  • DataTableExtensions: Helpers for trimming, exporting, and manipulating DataTables.
  • DataReaderExtensions: Helpers for mapping data readers to objects.

MsSql.cs

A comprehensive static utility class for SQL Server operations, including:

  • Scalar and table queries
  • Bulk copy (table-to-table, DataTable-to-table)
  • CSV export
  • Stored procedure execution
  • Data validation and schema inspection

Result

All service operations return an Result (from Aspireng.Operations), encapsulating:

  • Success/failure status
  • Messages and error details
  • HTTP status codes (where relevant)
  • Factory methods for common result types

Dependencies

  • .NET Standard / .NET Core/5+/6+/7+/8+/9+
  • Microsoft.Data.SqlClient
  • Microsoft.Extensions.Caching.Abstractions
  • Microsoft.Extensions.Caching.Memory
  • System.Data.Odbc
  • Other Aspireng modules (Caching, Logging, Operations, Reflection, Security, Text, Time)

Usage

Example: Using a Data Store

var sqlStore = new SqlDataStore<MyEntity>(connectionString);
await sqlStore.SaveAsync(new MyEntity { ... });
var entity = await sqlStore.GetByIdAsync("entity-id");

Example: Using a Service

var service = new MyEntityService(cache, sqlStore, logger);
var result = await service.GetAllAsync();
if (result.Succeeded) {
    // Use result.Data
}

Example: Encrypting Entity Fields

public class User : BaseEntity
{
    [Encrypt]
    public string SensitiveData { get; set; }
}

Extending

  • Implement new data stores by inheriting IDataStore<T>.
  • Create new services by inheriting BaseService<T>, BaseSqlService<T>, or BaseServiceSingular<T>.
  • Add new entity models by inheriting BaseEntity.

License

Licensed by Nova Globen AB. For commercial use or licensing, contact info@nova-globen.se.

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 (1)

Showing the top 1 NuGet packages that depend on Aspireng.Data:

Package Downloads
Aspireng.ProcessHandler

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.1.3 65 8/22/2025
1.1.2 65 8/22/2025
1.1.1 65 8/22/2025
1.0.9 68 8/22/2025
1.0.8 60 8/22/2025
1.0.7 81 8/22/2025
1.0.6 124 8/21/2025
1.0.5 126 8/20/2025
1.0.4 126 8/20/2025