I think I found a regression between versions 1.0.4 and 1.2.0. In version 1.0.4, the type <table>Reader class was defined right below the type <table> record. In version 1.2.0, the table records are all defined at the top and the reader classes are all defined below that. If two tables happen to have the same column names, the type inference in the \
Reader class will be wrong in the .Read() method.
E.g., I have one table defined as { id : byte; name : string }, and another table defined as { id : int16; name : string }. After running dotnet sqlhydra-mssql, the generated code won't compile because the Reader class for one of the tables is inferred to have the return type of the other table (and I get a compile error about type int16 not matching type byte). I think this could be resolved by either moving the Reader classes back to right below the table record they match, or by just annotating the return type of the Reader.Read() method.
I think I found a regression between versions 1.0.4 and 1.2.0. In version 1.0.4, the
type <table>Reader
class was defined right below thetype <table>
record. In version 1.2.0, the table records are all defined at the top and the reader classes are all defined below that. If two tables happen to have the same column names, the type inference in the \.Read()
method.E.g., I have one table defined as
{ id : byte; name : string }
, and another table defined as{ id : int16; name : string }
. After runningdotnet sqlhydra-mssql
, the generated code won't compile because the Reader class for one of the tables is inferred to have the return type of the other table (and I get a compile error about type int16 not matching type byte). I think this could be resolved by either moving the Reader classes back to right below the table record they match, or by just annotating the return type of theReader.Read()
method.That makes sense. It sounds like annotating the return type would be the easiest approach.
Fixed: https://github.com/JordanMarr/SqlHydra/releases/tag/v1.2.1
Wow thanks for the fast response on this!