Provide a way to serialize DateTime using millis or micros
Describe the solution you'd like We have a need to serialize DateTime values as a millis logical type, not micros, which is the default. There isn't a way to select a different logical type that I can see.
Describe implementation idea
Perhaps a LogicalTypeAttribute with a way to select a specific logical type for a property would be the way to go? I'm not sure what other mechanism could solve this, though you may perhaps have some ideas.
Hey,
Maybe it would make sense to create a fully flexible AvroTypeAttribute. I will check out the options.
Best,
Adrian
Hello @robertcoltheart
Thank you for your contribution. The new feature is available from v.3.4.7 of AvroConvert. Example usage:
public class TypeAttributeClass
{
[AvroType(AvroTypeRepresentation.Double)]
public int Int;
[AvroType(AvroTypeRepresentation.TimestampMilliseconds)]
public DateTime DateTime;
}
Regards, Adrian