Skip to content

Register PG extensions in the model by convention - #2161

Merged
roji merged 2 commits into
npgsql:mainfrom
roji:PluginExtensionConventions
Dec 30, 2021
Merged

roji merged 2 commits into
npgsql:mainfrom
roji:PluginExtensionConventions

Conversation

@roji

@roji roji commented Dec 17, 2021

Copy link
Copy Markdown
Member

By scanning property types in the model.

@AndriySvyryd, this adds two ModelFinalizing conventions which scan all properties, get their type mappings, and for certain supported types that are known to require PostgreSQL extensions, adds those to the model. Up to now users have had to add these explicitly. Any intuition on whether this is problematic perf-wise?

Closes #2137

@roji
roji force-pushed the PluginExtensionConventions branch 2 times, most recently from b032373 to b181606 Compare December 17, 2021 19:16
@AndriySvyryd

Copy link
Copy Markdown

Any reason not to add these extensions always? I assume there's a high chance they would be needed when the plugin is used.

@roji

roji commented Dec 20, 2021

Copy link
Copy Markdown
Member Author

For the NetTopologySuite plugin you're right - I'll do that at the minimum to avoid yet another pass over the model.

The problem is with the convention in the provider itself, for types which rare (hstore, ltree, lquery...); I definitely don't want to add those fringe extensions for everyone...

By scanning property types in the model.

Closes npgsql#2137
@roji
roji force-pushed the PluginExtensionConventions branch from b181606 to f577c05 Compare December 20, 2021 19:03
@AndriySvyryd

Copy link
Copy Markdown

Once dotnet/efcore#9329 is implemented this shouldn't be too bad perf-wise

@roji
roji force-pushed the PluginExtensionConventions branch from 0a1e3b4 to 351d6a8 Compare December 30, 2021 15:01
@roji
roji merged commit f6e9789 into npgsql:main Dec 30, 2021
@roji
roji deleted the PluginExtensionConventions branch December 30, 2021 15:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Consider adding PostgreSQL extensions to the model by convention

2 participants