Unable to use PostgreSQL as an event store
Describe the bug
When I use PostgreSQL as the event store in an Asp.NET Core application, any attempt to write an event, even a do-nothing, empty event, results in an InvalidCastException with the message: "Writing values of 'Eventuous.Sql.Base.NewPersistedEvent[]' is not supported for parameters having no NpgsqlDbType or DataTypeName. Try setting one of these values to the expected database type."
To Reproduce Steps to reproduce the behavior:
See the code and instructions in the repository at https://github.com/Steve-OH/postgres-exception-test
Expected behavior
It should be possible to use PostgreSQL as an event store.
Desktop (please complete the following information):
- OS: Windows 10 Pro 22H2
- Browser: n/a
- Versions:
- Eventuous 0.15.1
- Eventuous.Extensions.ApsNetCore 0.15.1
- Eventuous.Extensions.DependencyInjection 0.15.1
- Eventuous.Postgresql 0.15.1
- Npgsql 8.0.7
- System.Text.Json 8.0.5
- PostgreSQL 17.0 (Debian 17.0-1.pgdg120+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 12.2.0-14) 12.2.0, 64-bit
Edit: Added PostgreSQL version info
I would suggest trying the Postgres sample and comparing the setup between your app and the sample.
I just fixed this in a PR. Add a line at the end of the InitialiseDatabase() method: await ds.ReloadTypesAsync();