title: .NET6 and DateTime problem. Cannot write DateTime with Kind=UTC to PostgreSQL type 'timestamp without time zone'
body: <p>I have common problem.</p>
  <blockquote>
  <p>Cannot write DateTime with Kind=UTC to PostgreSQL type 'timestamp
  without time zone'</p>
  </blockquote>
  <p>And I want to enable Legacy Timestamp behavoour as is documented here:
  <a href="https://github.com/npgsql/doc/blob/main/conceptual/Npgsql/types/datetime.md/" rel="noreferrer">https://github.com/npgsql/doc/blob/main/conceptual/Npgsql/types/datetime.md/</a></p>
  <pre><code>public MyDbContext(DbContextOptions&lt;MyDbContext&gt; contextOptions) : base(contextOptions)
          {
              AppContext.SetSwitch(&quot;Npgsql.EnableLegacyTimestampBehavior&quot;, true);
              AppContext.SetSwitch(&quot;Npgsql.DisableDateTimeInfinityConversions&quot;, true);
          }
  </code></pre>
  <p>But doesn't work. I still get same error.</p>
  <p>What I am doing wrong. Why legacy behaviour doesn't work?</p>