Open
Description
Steps to replicate:
- Use
nhibernate
with npgsql - Create an entity with a
DateTimeOffset
property - Create a PostgresQL database table with
timestamptz
column - Use appropriate column name mapping (we use FluentNHibernate for this)
- Try to get the entity in a
nhibernate
session
What happens:
Throws Unhandled Exception: System.InvalidCastException: Unable to cast object of type 'System.DateTime' to type 'System.DateTimeOffset'
What should happen:
timestamptz
column should map neatly to the DateTimeOffset
property
Suggested solution:
Workaround from npgsql/npgsql#2641 (comment)