-
Notifications
You must be signed in to change notification settings - Fork 228
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Custom types (enums) aren't available right after creation #2815
Comments
This is explicitly called out in the documentation. |
Oh, really. It least, somebody (who is as attentive as me) can google the solution now :) |
Tried the code from the docs:
... where connection is disposed instead of just closing (that doesn't always close the connection, but releases it in case it's pooled). Btw, is there a reason to reload types manually? Why EF can't just do that inside PS. This is for another topic, but... Enums mapping is too complicated, requires duplication ( |
Yeah, makes sense - it should do Close (in a finally) instead of
This really is a very PostgreSQL-specific need, and there's currently no EF extension hook for doing something after applying all migrations. In any case, applying migrations from inside your application is discouraged for most scenarios (see these docs), and this problem affects only that method. I'd recommend looking at more robust ways of applying migrations, such as migration bundles.
Yeah, you're absolutely right - and a lot of the complexity indeed comes from the support being spread across both EF and Npgsql. For the duplication side, I have some thoughts in #2542 which would help; there's also #1026 which is older but may still be relevant. I definitely agree this should improve, but it hasn't been high-priority enough up to now... |
Thanks for the doc update @toxsedyshev! |
STR:
The issue: an absence of that new types in
NpgsqlDatabaseInfo.ByName
/ByFullName
Dictionaries.Workaround:
To reload types right after migration:
The text was updated successfully, but these errors were encountered: