jehugaleahsa / FlatFiles

Reads and writes CSV, fixed-length and other flat file formats with a focus on schema definition, configuration and speed.
The Unlicense
357 stars 64 forks source link

FlatFiles does not support uint or short #18

Closed silkfire closed 7 years ago

silkfire commented 7 years ago

It looks like FlatFiles currently doesn't support mapping to uint or short, I need to change my types to int or I'm getting exceptions (something with Property not selected).

jehugaleahsa commented 7 years ago

Is this specific to type mappers? It's true there's no support for unsigned types, but there is mapping support for Int16 (short). Any more detail you can provide would be great.

On Apr 30, 2017 8:46 PM, "silkfire" notifications@github.com wrote:

It looks like FlatFiles currently doesn't support mapping to uint or short, I need to change my types to int or I'm getting exceptions (something with Property not selected).

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/jehugaleahsa/FlatFiles/issues/18, or mute the thread https://github.com/notifications/unsubscribe-auth/ABTgPloNDoGECZS32WJLgrirL8rZXLVOks5r1StpgaJpZM4NMv5x .

silkfire commented 7 years ago

Yes I'm using type mappers exclusively, I find them actually very clean and streamlined.

_flatFileTypeMapper.Property(sr => sr.Value, new Window(7) { Alignment = FixedAlignment.RightAligned });

If the Value property is defined as a uint, I'm getting an exception.

jehugaleahsa commented 7 years ago

Behind the scenes .NET is casting the uint to long, which is being captured in the expression tree. Unfortunately, that cast prevents FlatFiles from correctly identifying the Value property.

Tomorrow, I'll look into adding unsigned support. Should be a trivial change. It's surprising it's not come up before.

On Apr 30, 2017 8:57 PM, "silkfire" notifications@github.com wrote:

Yes I'm using type mappers exclusively, I find them actually very clean and streamlined.

_flatFileTypeMapper.Property(sr => sr.Value, new Window(7) { Alignment = FixedAlignment.RightAligned });

If the Value property is defined as a uint, I'm getting an exception.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/jehugaleahsa/FlatFiles/issues/18#issuecomment-298269048, or mute the thread https://github.com/notifications/unsubscribe-auth/ABTgPrh8-CFQeGRBDH5xKcOAnpnUj2I4ks5r1S3ggaJpZM4NMv5x .

silkfire commented 7 years ago

Thank you. Looking forward to the update.

jehugaleahsa commented 7 years ago

As soon as NuGet refreshes, you should see a 0.3.20.0 version. I added support for sbyte, uint16, uint32 and uint64. Let me know if you encounter any issues.