Transformation Exception 'DateTime is not a member of type NpgsqlTypes.NpgsqlDateTime'
See original GitHub issueEverytime when transforming PostgreSQL…tt I got an exception -see below- saying that DateTime is not a member of type NpgsqlTypes.NpgsqlDateTime. I’m using Postgres 9.6 (Database), npgsql.dll (v3.2.0) and linq2db (v1.7.5). By the way, do I still need to add
<#@ assembly name="$(SolutionDir)packages\linq2db.1.7.5\lib\net45\linq2db.dll" #>
<#@ assembly name="$(SolutionDir)packages\Npgsql.3.2.0\lib\net451\Npgsql.dll" #>
to the header of PostgreSQL.tt in order to successfully transform??? Version 1.7.3 is working without any problems.
Thanks in advance.
Cheers.
Severity Code Description Project File Line Suppression State
Error Running transformation: System.ArgumentException: 'DateTime' is not a member of type 'NpgsqlTypes.NpgsqlDateTime'
at System.Linq.Expressions.Expression.PropertyOrField(Expression expression, String propertyOrFieldName)
at LinqToDB.DataProvider.PostgreSQL.PostgreSQLDataProvider.OnConnectionTypeCreated(Type connectionType) in c:\projects\linq2db\Source\DataProvider\PostgreSQL\PostgreSQLDataProvider.cs:line 166
at LinqToDB.DataProvider.DynamicDataProviderBase.GetConnectionType() in c:\projects\linq2db\Source\DataProvider\DynamicDataProviderBase.cs:line 40
at LinqToDB.DataProvider.DynamicDataProviderBase.CreateConnectionInternal(String connectionString) in c:\projects\linq2db\Source\DataProvider\DynamicDataProviderBase.cs:line 63
at LinqToDB.DataProvider.DataProviderBase.CreateConnection(String connectionString) in c:\projects\linq2db\Source\DataProvider\DataProviderBase.cs:line 76
at LinqToDB.Data.DataConnection.get_Connection() in c:\projects\linq2db\Source\Data\DataConnection.cs:line 520
at LinqToDB.SchemaProvider.SchemaProviderBase.GetSchema(DataConnection dataConnection, GetSchemaOptions options) in c:\projects\linq2db\Source\SchemaProvider\SchemaProviderBase.cs:line 49
at Microsoft.VisualStudio.TextTemplatingC4A9431148BBB115F7FB8192247A57F2BDFBEDB28815ECC4462D4D91C10D5DEE014A4AA4D0E0D1691F6567EED2BD8370B133C78A3DF343E490060B87D89747A4.GeneratedTextTransformation.LoadServerMetadata(DataConnection dataConnection) in F:\Temp\linq2dbTest\linq2dbTest\linq2dbTest\LinqToDB.Templates\DataModel.ttinclude:line 56
at Microsoft.VisualStudio.TextTemplatingC4A9431148BBB115F7FB8192247A57F2BDFBEDB28815ECC4462D4D91C10D5DEE014A4AA4D0E0D1691F6567EED2BD8370B133C78A3DF343E490060B87D89747A4.GeneratedTextTransformation.LoadMetadata(DataConnection dataConnection) in F:\Temp\linq2dbTest\linq2dbTest\linq2dbTest\LinqToDB.Templates\DataModel.ttinclude:line 310
at Microsoft.VisualStudio.TextTemplatingC4A9431148BBB115F7FB8192247A57F2BDFBEDB28815ECC4462D4D91C10D5DEE014A4AA4D0E0D1691F6567EED2BD8370B133C78A3DF343E490060B87D89747A4.GeneratedTextTransformation.LoadPostgreSQLMetadata(String connectionString) in F:\Temp\linq2dbTest\linq2dbTest\linq2dbTest\LinqToDB.Templates\LinqToDB.PostgreSQL.ttinclude:line 49
at Microsoft.VisualStudio.TextTemplatingC4A9431148BBB115F7FB8192247A57F2BDFBEDB28815ECC4462D4D91C10D5DEE014A4AA4D0E0D1691F6567EED2BD8370B133C78A3DF343E490060B87D89747A4.GeneratedTextTransformation.TransformText() in F:\Temp\linq2dbTest\linq2dbTest\linq2dbTest\DBModel\Post.tt:line 42 c:\projects\linq2db\Source\DataProvider\PostgreSQL\PostgreSQLDataProvider.cs 166
Issue Analytics
- State:
- Created 7 years ago
- Comments:10 (9 by maintainers)
Top Results From Across the Web
Cannot write DateTime with Kind=UTC to PostgreSQL type ...
A. Solved by adding. AppContext.SetSwitch("Npgsql.EnableLegacyTimestampBehavior", true); to the Startup Configure method.
Read more >Date and Time Handling
Starting with 6.0, Npgsql maps UTC DateTime to timestamp with time zone , and Local/Unspecified DateTime to timestamp without time zone ; trying...
Read more >Datetime error with .NET 6 and PostgreSQL - Duong's Blog
While upgrading a project to .NET 6, I ran into an datetime issue with the latest npgsql efcore provider. Today, we will look...
Read more >HnD | timestamptz is wrongly saved, Page 1
We use the DateTime value, not an npgsql type. We simply send the DateTime as-is to the DB, so we don't do any...
Read more >Mapping .NET Timestamps to PostgreSQL - Shay Rojansky
We now send UTC DateTime as timestamptz , and Local/Unspecified DateTime as timestamp ; trying to send a non-UTC DateTime as timestamptz will ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I’ll prepare
fixed, thanks to @sdanyliv 😃