Introduces a Source Generator for AOT creation of deserializers, and cleans up some of the work from #41 .
As with #41, the source generator produces a new type that is used to back some delegates when using the AheadOfTimeTypeDescriber.
Visible changes
New Attributes
GenerateDeserializerAttribute - added to classes to cause a deserializer to be generated at compile time
DeserializerMemberAttribute - added to members to expose them as a column during deserialization
DeserializerInstanceProviderAttribute - added to methods or constructors to specify a way to obtain an instance while deserializing (using the AheadOfTimeTypeDescriber)
A number of attributes from #41 were renamed to better match these attributes
Default treatment of properties is now the same between ahead-of-time and runtime behaviors, if they are public and instance they will be included by default
Cesil.SourceGenerator now targets netstandard2.0, and depends on 3.8.0 Roslyn packages
This necessary for latest Visual Studio to successfully load the generators, although tests do not care
Internal changes
DefaultTypeParsers updated for easier inclusion into the generated source in a piecemeal fashion
DeserializableMember now supports being backed by a pre-generated method
A new row constructor, AheadOfTimeRowConstructor<TRow>, that knows how to use the Source Generator created class
IRowConstructor<TRow> has been changed to make some new use cases more convenient
New Parser, Reset, Setter, and InstanceProvider wrapper equivalents in Cesil.SourceGenerator, mirroring the wrappers used at runtime
A number of features exposed in netstandard 2.1 are no longer used in Cesil.SourceGenerator
Commentary
While this code is reasonably tested, it is not yet up to Cesil's general standards. Since there are lots of open questions around Source Generator best practices, I consider this OK for now - before 1.0 it will need to be addressed.
Introduces a Source Generator for AOT creation of deserializers, and cleans up some of the work from #41 .
As with #41, the source generator produces a new type that is used to back some delegates when using the
AheadOfTimeTypeDescriber
.Visible changes
GenerateDeserializerAttribute
- added to classes to cause a deserializer to be generated at compile timeDeserializerMemberAttribute
- added to members to expose them as a column during deserializationDeserializerInstanceProviderAttribute
- added to methods or constructors to specify a way to obtain an instance while deserializing (using theAheadOfTimeTypeDescriber
)Cesil.SourceGenerator
now targets netstandard2.0, and depends on 3.8.0 Roslyn packagesInternal changes
DefaultTypeParsers
updated for easier inclusion into the generated source in a piecemeal fashionDeserializableMember
now supports being backed by a pre-generated methodAheadOfTimeRowConstructor<TRow>
, that knows how to use the Source Generator created classIRowConstructor<TRow>
has been changed to make some new use cases more convenientParser
,Reset
,Setter
, andInstanceProvider
wrapper equivalents inCesil.SourceGenerator
, mirroring the wrappers used at runtimeCesil.SourceGenerator
Commentary
While this code is reasonably tested, it is not yet up to Cesil's general standards. Since there are lots of open questions around Source Generator best practices, I consider this OK for now - before 1.0 it will need to be addressed.