You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using QueryToListAsync<Test> where Test is a record with a primary constructor and [property: Column("some_column")] attributes, it appears the column names specified in the attributes are not being used. If the record does not have a constructor, then it works fine. Additionally, using connection.GetTable<MyType>() to query, then the record with a primary constructor also works. Removing the constructor makes it work with QueryToListAsync.
Steps to reproduce
Using the following as our table/query result type
Describe your issue
When using
QueryToListAsync<Test>
whereTest
is a record with a primary constructor and[property: Column("some_column")]
attributes, it appears the column names specified in the attributes are not being used. If the record does not have a constructor, then it works fine. Additionally, usingconnection.GetTable<MyType>()
to query, then the record with a primary constructor also works. Removing the constructor makes it work withQueryToListAsync
.Steps to reproduce
Using the following as our table/query result type
When using the following:
The resulting records will have
null
inSomeColumn
because the[Column]
attribute which provides the correct name is not being used.If instead I do
Then the column mapping works and I get the expected value in
SomeColumn
.If I change my record to not have a constructor, then everything works fine with
QueryToListAsync
as well:Is there a difference in how Linq2Db handles object mapping for LINQ-based queries vs SQL-based ones?
Environment details
Linq To DB
version: 5.4Database (with version): Postgres 13
ADO.NET Provider (with version): Npgsql 8.0
Operating system: macOS
.NET Version: 8.0
The text was updated successfully, but these errors were encountered: