I am updating our main project in dotnet to use PostgreSQL on the backend instead of Microsoft SQL Server and get into the situation of two tables using the GUID as the data type.
ERROR
Unhandled Exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.InvalidOperationException: Property CommentID on type is a database-generated uuid, which requires the PostgreSQL uuid-ossp extension. Add .HasPostgresExtension("uuid-ossp") to your context OnModelCreating.
After a short Google search, I realized that I had to activate the uuid extension (not sure if it could be automated somehow), and then generated the uuid in pgAdmin successfully.
CREATE EXTENSION "uuid-ossp"; SELECT uuid_generate_v4();
Unfortunately, my dotnet project is still complaining about the same error. I see in error that he says adding .HasPostgresExtension ("uuid-ossp") to OnModelCreating , and I tried in several places, but I canβt figure out exactly where to add it.
chris source share