question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Transformation Exception 'DateTime is not a member of type NpgsqlTypes.NpgsqlDateTime'

See original GitHub issue

Everytime 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:closed
  • Created 7 years ago
  • Comments:10 (9 by maintainers)

github_iconTop GitHub Comments

2reactions
sdanylivcommented, Feb 3, 2017

I’ll prepare

0reactions
ilicommented, Feb 4, 2017

fixed, thanks to @sdanyliv 😃

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found