MeshWeaver.DataSetReader
3.0.0-rc3
This is a prerelease version of MeshWeaver.DataSetReader.
The owner has unlisted this package.
This could mean that the package is deprecated, has security vulnerabilities or shouldn't be used anymore.
dotnet add package MeshWeaver.DataSetReader --version 3.0.0-rc3
NuGet\Install-Package MeshWeaver.DataSetReader -Version 3.0.0-rc3
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="MeshWeaver.DataSetReader" Version="3.0.0-rc3" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="MeshWeaver.DataSetReader" Version="3.0.0-rc3" />
<PackageReference Include="MeshWeaver.DataSetReader" />
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 MeshWeaver.DataSetReader --version 3.0.0-rc3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: MeshWeaver.DataSetReader, 3.0.0-rc3"
#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 MeshWeaver.DataSetReader@3.0.0-rc3
#: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=MeshWeaver.DataSetReader&version=3.0.0-rc3&prerelease
#tool nuget:?package=MeshWeaver.DataSetReader&version=3.0.0-rc3&prerelease
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
MeshWeaver.DataSetReader
MeshWeaver.DataSetReader is a foundational library that provides base classes and abstractions for implementing data readers in the MeshWeaver ecosystem. It serves as the core framework for creating specialized data readers for various file formats.
Overview
The library provides:
- Base classes for implementing data readers
- Common abstractions and interfaces
- Utility functions for data reading operations
- Integration with MeshWeaver.DataStructures
Architecture
Core Components
Base Classes
- Abstract reader implementations
- Format-specific base classes
- Common utility functions
- Error handling infrastructure
Interfaces
- Reader interfaces
- Factory interfaces
- Stream handling interfaces
- Configuration interfaces
Supported Implementations
The framework supports multiple reader implementations, including:
Excel Readers
- Binary format (.xls)
- OpenXML format (.xlsx)
- Custom properties support
- Multi-sheet handling
CSV Reader
- Standard CSV format
- Custom delimiters
- Header row handling
- Data type inference
Usage Examples
Implementing a Custom Reader
public class CustomFormatReader : DataSetReaderBase
{
protected override IDataSet ReadDataSetFromStream(Stream stream)
{
var dataSet = new DataSet();
var table = dataSet.Tables.Add("Data");
// Implement format-specific reading logic
using (var reader = new StreamReader(stream))
{
// Read data and populate table
// ...
}
return dataSet;
}
}
Using Reader Factory Pattern
public class CustomReaderFactory : IDataSetReaderFactory
{
public IDataSetReader CreateReader(string format)
{
return format.ToLower() switch
{
"custom" => new CustomFormatReader(),
_ => throw new NotSupportedException($"Format {format} not supported")
};
}
}
Reading Data
public async Task<IDataSet> ReadDataAsync(Stream stream, string format)
{
var factory = new CustomReaderFactory();
var reader = factory.CreateReader(format);
return await reader.ReadAsync(stream);
}
Extension Points
Format Support
- Implement new format readers
- Add custom data type handling
- Extend configuration options
- Add format-specific features
Data Processing
- Custom data transformation
- Data validation
- Error handling
- Progress reporting
Best Practices
Error Handling
- Implement proper error handling
- Provide meaningful error messages
- Handle format-specific exceptions
- Support error recovery
Performance
- Use streaming where possible
- Implement efficient memory usage
- Support large file handling
- Consider async operations
Data Validation
- Validate input format
- Check data consistency
- Verify column types
- Handle missing data
Configuration
- Support flexible configuration
- Allow format-specific options
- Enable feature toggles
- Provide sensible defaults
Integration
With DataStructures
public class IntegratedReader : DataSetReaderBase
{
protected override IDataSet ReadDataSetFromStream(Stream stream)
{
var dataSet = new DataSet();
// Implement reading logic that creates proper DataStructures
return dataSet;
}
}
With Message Hub
services.AddMessageHub(hub => hub
.ConfigureServices(services => services
.AddSingleton<IDataSetReaderFactory, CustomReaderFactory>()
)
);
Testing Support
The library includes base test classes to help implement reader tests:
public class CustomReaderTests : DataSetReaderTestBase
{
protected override void ValidateDataSet(IDataSet dataSet)
{
// Implement format-specific validation
}
[Fact]
public async Task ReadsValidFile()
{
var reader = new CustomFormatReader();
var result = await reader.ReadAsync(GetTestStream());
ValidateDataSet(result);
}
}
Related Projects
- MeshWeaver.DataSetReader.Excel - Excel format implementation
- MeshWeaver.DataSetReader.Csv - CSV format implementation
- MeshWeaver.DataStructures - Core data structures
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. 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.
-
net10.0
- MeshWeaver.DataStructures (>= 3.0.0-rc3)
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 |
|---|