ListTableBridge 1.0.0

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

ListTableBridge

High-performance, strongly-typed DataTable ⇄ List<T> conversion for .NET.

ListTableBridge focuses on fast, attribute-aware mapping between DataTable and POCO models, with first-class support for XAF-style display attributes and rich numeric/nullable type handling.


Features

  • Bidirectional conversion

    • List<T> → DataTable
    • DataTable → List<T>
  • Attribute-based column mapping (property level)

    • Priority: XafDisplayName > DisplayName > Display > property name
    • Works with real DevExpress XAF attributes at runtime (no hard dependency in this package)
  • Enum element attribute reading (optional)

    • Can emit enum display names (from XafDisplayName / DisplayName / Display) to string columns
    • Can parse string columns back to enum values by name or display name
    • Controlled by enableElementFeatureReading (default: false for backward compatibility)
  • Rich type coverage

    • Primitive types: int, long, short, byte, float, double, decimal, bool, char, string, DateTime
    • Nullable counterparts: int?, double?, decimal?, etc.
    • Special types: Guid, DateTimeOffset, TimeSpan
    • Nullable handling and DBNull.Value mapping
  • Performance-oriented design

    • Caches type metadata and compiled expression-based getters/setters
    • Avoids repeated reflection for large batch conversions
  • Tested

    • xUnit test suite covering numeric subtypes, nullable combinations, enums, strings, and performance

Installation

Install from NuGet:

dotnet add package ListTableBridge

Supported target frameworks:

  • .NET Framework 4.5+
  • .NET Standard 2.0+

Quick Start

List<T> → DataTable

using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using DevExpress.Persistent.Base; // in your XAF project
using ListTableBridge;

public class Customer
{
    [XafDisplayName("Customer Id")]
    public int Id { get; set; }

    [DisplayName("Customer Name")]
    public string Name { get; set; }

    [Display(Name = "Status")]
    public CustomerStatus Status { get; set; }
}

public enum CustomerStatus
{
    [XafDisplayName("Active")]
    Active = 1,

    [XafDisplayName("Inactive")]
    Inactive = 2
}

var customers = new List<Customer>
{
    new Customer { Id = 1, Name = "Alice", Status = CustomerStatus.Active },
    new Customer { Id = 2, Name = "Bob", Status = CustomerStatus.Inactive }
};

// Attribute-driven column names (XafDisplayName / DisplayName / Display / property name)
var table = ListTableBridge.ListTableBridge.ToDataTable(customers);

DataTable → List<T>

using System.Data;
using ListTableBridge;

DataTable table = /* from database or other source */;

// Column names can be XafDisplayName / DisplayName / Display / property name
var customers = ListTableBridge.ListTableBridge.ToList<Customer>(table);

Enum Element Attribute Reading

For enum-backed string columns, you can control whether to use enum element attributes as values.

// List<T> → DataTable: write enum display names into the column
var table = ListTableBridge.ListTableBridge.ToDataTable(
    customers,
    enableElementFeatureReading: true
);

// DataTable → List<T>: read from enum names or display names
var customersBack = ListTableBridge.ListTableBridge.ToList<Customer>(
    table,
    enableElementFeatureReading: true
);

Behavior:

  • When enableElementFeatureReading == true:

    • Writing: prefers XafDisplayName / DisplayName / Display on enum fields
    • Reading: first tries enum name, then all candidate display names, then falls back to Enum.Parse
  • When enableElementFeatureReading == false:

    • Uses only enum name / numeric value for parsing and formatting

Type Conversion and Null Handling

Conversion is centralized in TypeMappingConfig:

  • DBNull.Valuenull for reference and nullable types
  • Non-nullable value types use their default value when given null/DBNull
  • Enums:
    • string → Enum.Parse
    • numeric → converted to underlying enum type, then Enum.ToObject
  • Special types:
    • Guid: supports Guid and string inputs
    • DateTimeOffset: supports DateTimeOffset, DateTime, and string
    • TimeSpan: supports TimeSpan and string

You can register custom converters:

TypeMappingConfig.Default.Register(
    typeof(MyCustomType),
    v => MyCustomType.Parse(v.ToString())
);

Testing

Run tests:

dotnet test .\ListTableBridge.sln

The test suite includes:

  • Round-trip tests for numeric primitives and nullable combinations
  • Enum mapping (names and display attributes)
  • String edge cases (Unicode, long text)
  • Performance sample for large collections

License

This project is licensed under the MIT License.

You are free to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the software, subject to the standard MIT terms.

See the full license text in the LICENSE file (or MIT template) in your distribution.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net45 is compatible.  net451 was computed.  net452 was computed.  net46 was computed.  net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos 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
1.0.0 120 2/19/2026