DelimitedRecordAttribute Class
Definition
- Assembly
- Bodu.Text.Delimited.dll
- Package
- Bodu.Text.Delimited 1.3.0
Marks a partial record POCO for compile-time delimited binding: the Bodu.Text.Formats.Generators source
generator emits an IDelimitedRecordFactory<TRecord> implementation for the type, exposed through a
generated static DelimitedFactory property.
[AttributeUsage(AttributeTargets.Class|AttributeTargets.Struct, AllowMultiple = false, Inherited = false)]
public sealed class DelimitedRecordAttribute : Attribute
- Inheritance
-
DelimitedRecordAttribute
- Attributes
-
System.AttributeUsageAttribute
- Inherited Members
- Extension Methods
Remarks
The generated factory maps the public read/write instance properties declared on the type, in declaration order, honoring PropertyNameAttribute for column names and skipping members annotated IgnoreAttribute with Always, the default condition; a member annotated with another condition is mapped and always written. Scalar values convert with the invariant culture, in the forms the reflection binder of DelimitedSerializer uses, so for the members both map the two paths write the same text and read it alike: temporal values in their round-trip forms, and null for a nullable member whose field is empty or white space, except a nullable char, which takes only an empty field as null.
The annotated type must be declared partial so the generator can add the factory to it. Passing the generated factory to the DelimitedSerializer factory overloads avoids the reflection binder entirely, making the serialization path trimming- and AOT-safe.
Constructors
DelimitedRecordAttribute()
public DelimitedRecordAttribute()
Applies to
| Product | Versions |
|---|---|
| .NET | 8, 10 |