

Return (DateTimeOffset)((NpgsqlTimeStampTZ)x)

Return (DateTime?)((NpgsqlTimeStampTZ)x) || DestType = typeof(DateTime) || DestType = typeof(DateTime?)) if (DestType = typeof(DateTimeOffset) || DestType = typeof(DateTimeOffset?) Note: Npgsql does not automatically convert “timestamptz” types to DateTimeOffset, but using NPoco’s built in Mapper we can do this ourselves. This will return “TimeStampTz” types using Npgsql’s own type “NpgsqlTimeStampTZ” instead of a plain DateTime. The important part here is that you use the “User Extended Types=true”. Now we are setup to create our connection string. Once this has been installed, we need to make a change to the web.config. From the Package Manager Console type: Install-Package Npgsql Firstly you need to install the Npgsql driver from NuGet. Setting up PostgreSQL to run with NPoco is very simple.
