-
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
Support rewriting primary key name with TPT #57
Comments
Is this being looked into? It is a fairly critical feature for us, we have a whole existing database model we are trying to connect to using ef core and this is a blocking issue. Can be easily reproduced with the following SQL model derived from the documentation itself:
|
@DMX-David-Cardinal as written above, the root issue is missing support in EF Core itself - tracked by dotnet/efcore#19811. In the meantime, you can explicitly name your PKs using the Fluent API - this should unblock you. |
When you say "the issue is missing support", I understand that no one is working on this at the moment and there is no estimate about when this will be ready? Also, can you precise what you mean by explicitly naming the PKs using the fluent API? Because from what I tried it seemed like an impass though I might be missing something. When you say explicitly naming the Pk, this is what I understand:
Yet this gives the following error: "Invalid column name 'FkBlogId'" (It isn't a typo; if I change the F for a P in both the database and the model and remove that line in the modelBuild, everything seems to run fine and as intended) This would be the class definitions:
|
dotnet/efcore#19811 is in the 6.0.0 milestone, meaning that we plan to do it for the next release of EF Core, planned for November.
This isn't about naming the column that's part of the PK, it's about the name of the PK itself, as in the docs. The issue is about having EFCore.NamingConventions rewrite that name, and that's blocked by dotnet/efcore#19811. For your issue with changing HasColumnName, can you please open a new issue with a full code sample? Also, please test whether your issue is actually related to EFCore.NamingConventions; if not, please open your issue in https://github.com/dotnet/efcore/issues. |
My apologies, I wasn't familiar with the process.
I don't see how to get around that since there is a clash between both PKs. Attempting to name the key on RssBlog gives the error
I don't think that's necessary.. It really seems like a byproduct of the column/key issues where either two properties are trying to map to the same column or the mapper tries to find |
@DMX-David-Cardinal just to make sure, it's perfectly OK to set the key name in a TPT hierarchy - but you have to do it at the root. Being able to set it on derived types would be part of dotnet/efcore#19811. |
Oh! Misunderstood the difference between the two issues. Apologies once again |
Rewriting is currently disabled for primary key names with TPT, because of dotnet/efcore#23444 (dotnet/efcore#19811).
The text was updated successfully, but these errors were encountered: