ServiceStack / Issues

Issue Tracker for the commercial versions of ServiceStack
11 stars 8 forks source link

PostgreSqlDialectProvider.GetDbType() uses Singleton. #749

Closed AVee closed 3 years ago

AVee commented 3 years ago

TL;DR: GetDbType() should not use PostgreSqlDialect.Instance.TypesMap, but this.TypesMap. See https://github.com/ServiceStack/ServiceStack.OrmLite/blob/master/src/ServiceStack.OrmLite.PostgreSQL/PostgreSQLDialectProvider.cs#L655

I subclassed PostgreSQLDialectProvider to add support for NodaTime types. Among other changes I added the NodaTime types to the TypesMap in this subclass. Elsewere in the code I was using the GetDbType() method, which I expected to now handle those types as well. However that method does it's lookup in PostgreSqlDialect.Instance.TypesMap and fails when called with the new types. If it would use this.TypesMap instead the method would work as I'd expect.

mythz commented 3 years ago

ok that's peculiar why I didn't use the local TypesMap instance, may have been a refactor from a static method.

Anyways, it's now fixed in this commit. This change is available from the latest v5.10.5+ that's now available on MyGet.

thx for reporting!