-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for .NET 6's DateOnly and TimeOnly in *TypeMapper #80
Comments
The alternative I described above of converting to |
The only working solution I've found thus far is to use a |
Using Normally when I want to add support for a new type, I create sub-classes of For older versions of .NET, first I look to see if there's a NuGet package that makes it available. It's nice if a NuGet package will allow older environments to utilize newer functionality. In this case, I am not seeing anything published by MS, which is a bit surprising. Since .NET 6 isn't something I am currently targeting, a new entry would need to be added in the FlatFiles.csproj. Then in the actual C# code, to conditionally include code depending on the .NET version, you need to wrap the code in a I have been debating for a while if I should pursue separating the mapping exercise (a.k.a., "type mapper" stuff) from the actual act of parsing files. I feel like I could define a generic interface to grab values from a data source and provide the same service. That would allow the convenience of defining things via type mappers to work over non-FlatFiles classes. Take one of the more popular CSV libraries for .NET and just create an adapter that allowed type mappers to work. ¯_(ツ)_/¯ There's only about a zillion other improvements I'd like to make also, but I have zero time for anything. |
Is there any traction here? Would love to use |
Is your feature request related to a problem? Please describe.
I don't know if I'd consider it a problem or not, but with the release of .NET 6, they introduced the types
DateOnly
andTimeOnly
, but FlatFiles does not appear to have a way to handle those yet on the *TypeMapper classes (SeparatedValueTypeMapper
andFixedLengthTypeMapper
).Describe the solution you'd like
I'd like to see FlatFiles have support for the
DateOnly
andTimeOnly
types of .NET 6, perhaps not just for the *TypeMapper classes but all throughout the library.Describe alternatives you've considered
The only alternative I've considered is to convert those types to
DateTime
to use the existing support in FlatFiles for that type. This is a bit painful, though, especially in the case of a nullableDateOnly
orTimeOnly
since the null-coalesce operator cannot be used. I also considered adding an extension method for the *TypeMapper classes, but that seems to be hard to accomplish with how many methods are private to those classes and not wanting to repeat too much code that is already in the library itself.Additional context
Since these types are .NET 6+ only, I do not know how easy it would be to support those alongside everything else.
The text was updated successfully, but these errors were encountered: