๐ What's Changed
โจ Fluent Message Factory Builder API
- Code-first configuration without XML โ a new
MessageFactoryBuilder<T>provides a fluent, type-safe API for constructing fully-configuredMessageFactoryinstances entirely in code. - ๐งฉ Supports all configuration options previously available only through XML: headers, templates, parse maps, custom fields, composite fields, and all factory properties.
- ๐ Template and parse-map inheritance via
Extends(), with field-level override and exclusion support. - ๐๏ธ New builder classes:
MessageFactoryBuilder<T>,TemplateBuilder,ParseMapBuilder, andCompositeFieldBuilder.
var factory = new MessageFactoryBuilder<IsoMessage>()
.WithEncoding(Encoding.UTF8)
.WithHeader(0x0200, "ISO")
.WithTemplate(0x0200, t => t
.Field(3, IsoType.NUMERIC, "000000", 6)
.Field(11, IsoType.NUMERIC, "000001", 6)
.Field(41, IsoType.ALPHA, "TERMINAL", 8))
.WithTemplate(0x0210, t => t
.Extends(0x0200)
.Field(39, IsoType.ALPHA, "00", 2))
.WithParseMap(0x0200, p => p
.Field(3, IsoType.NUMERIC, 6)
.Field(11, IsoType.NUMERIC, 6)
.Field(41, IsoType.ALPHA, 8))
.WithParseMap(0x0210, p => p
.Extends(0x0200)
.Field(39, IsoType.ALPHA, 2))
.Build();๐ PR: #42
โก Performance: Zero-Copy Parsing, Span<T>, Bitmap128 & Allocation Reductions
- ๐งฎ
Bitmap128struct backed byUInt128replacesBitArrayfor field-presence tracking โ significantly faster bit operations with zero heap allocations. - ๐ฌ
Span<T>andReadOnlySpan<T>used throughout parsing and encoding, enabling zero-copy byte/string conversions and eliminating intermediate array allocations. - ๐ Zero-copy byte utilities (
Bytesextensions) usingMemoryMarshal.Castfor reinterpreting betweenbyte[]andsbyte[]without copying. - ๐งต
Stringxextensions withGetSignedBytes()overloads that encode directly into destination buffers, plusArrayPool<T>pooled variants for hot paths. - ๐พ
EncodingCacheto avoid repeated encoding lookups. - ๐ฆ Reorganised internal utilities from
NetCore8583.UtilโNetCore8583.Extensionsnamespace for clearer separation. - ๐ง All field parsers,
IsoMessage,IsoValue,MessageFactory, and codec classes updated to use the new span-based APIs.
๐ PR: #41
โ ๏ธ Breaking Changes
- The
NetCore8583.Utilnamespace has been reorganised intoNetCore8583.Extensions. If you reference types likeHexCodec,Bcd,Arrays,OsUtil,Enumm,DictionaryExtensions, orParseExceptiondirectly, update yourusingstatements accordingly. - ๐๏ธ Removed:
ByteUtil,DateUtil,StringUtil,DictionaryExtensions,Enumm, andParseExceptionfromNetCore8583.Util(replaced by equivalents inNetCore8583.Extensions).
Full Changelog: 2.3.0...2.4.0