-
Notifications
You must be signed in to change notification settings - Fork 75
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
Rewrite schema name #56
Comments
You mean the namespace of the CLR entity type, right? What would be the desired behavior if more than one CLR type is mapped to the same table (e.g. table splitting), with different namespaces? Regardless, this plugin doesn't aim to support every name rewriting possibility that users may want (that would be an infinite list...). I can see value in allowing users to provide a hook for the actual rewriting function (tracked by #42), but rewriting the schema based on the CLR type is a much more advanced thing which wouldn't fit in that. |
Yes the Clr Entity Type. This is my convention, and I don't have that case so I don't handle it. As I said, I have my conventions that I register before the naming convention that set name as I want. But then I use your conventions for name rewriting. But the EFCore.NamingConventions does not touch schema name. So I'm proposing to just add the necessary code to also rewrite schema name (I'm willing to do the PR and also provide an options to activate schema rename or not). Thanks, |
@kYann are you saying you've written another EF Core plugin with this convention? Or some other mechanism? If you've written a plugin with a real convention, then having multiple conventions rewriting names is probably not going to work very well at this point in EF Core - there are some ordering/interference issues, and cases where this plugin would probably reset what you convention has already done. I'd recommend simply looping over all entities at the end of your OnModelCreating, and setting your schema there, that should work well without any sort of interference. |
Yes I have my own convention.
At this point, everything is working fine except that I don't have the schema name rewrited.
Also I'm expecting that it would work fine as the default naming is already done using conventions (the one from EFCore).
|
Well, I guess this plugin could rewrite the schema name if one is set by some previous convention (of course, leaving any explicit setting alone)... This way, if your convention runs before mine, everything should work OK... |
Having multiple conventions rewriting names currently won't work well because of lack of support on the EF infrastructure side. |
Hello,
I have a convention that set the schema name from the table namespace.
I could write a snake case namespace but I like having separate conventions (one for the naming, one for the "casing").
So it would be great if schema name were rewrite by the NamingConventions.
P.S. : I saw an issue on the subject but it was closed and you were looking for case where the schema name would not be explicitly set by the user (#28).
The text was updated successfully, but these errors were encountered: