-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Document scaffolded navigation breaking change #4608
Comments
Note for triage: this is a consequence of dotnet/efcore#29771, which stopped using common prefixes to generate navigation names. @shikamu Custom T4 templates can be used to customize the navigation names to whatever you choose. |
Note from triage: the new behavior is preferable to the old behavior, but for cases where the old behavior was reasonable we should document this as a breaking change. |
@ajcvickers thanks for the replies. Is there a ready to use T4 template that emulates the old behaviour ? this would be quite useful to have as this is essentially a breaking change, and we would then be able to get around it in an effortless fashion. |
@shikamu There is no specific template for this. Start from the default templates and edit the code that writes the navigation names. |
I'm working on a asp.net core backend that was on .net 6 and we're trying to migrate it to .net 8.
We have noticed a change for which we haven't yet found documentation. Given a simple
Test
database with the following 3 tables:I can use the following command to generate the c# classes:
dotnet ef dbcontext scaffold "Data Source=localhost\sqlexpress;Initial Catalog=Test;Integrated Security=True;MultipleActiveResultSets=True;TrustServerCertificate=True" Microsoft.EntityFrameworkCore.SqlServer -f
if I use net6.0, namely with exactly this csproj:
I get the following output for the
SomeTable
C# class:However, if I switch to net8.0, using exactly this csproj:
I get the following output:
Notice that with net6.0 and net7.0 we get this:
but with net8.0 we get this:
When I run the scaffold command in both cases I get the same output in both cases:
![image](https://private-user-images.githubusercontent.com/509192/293213149-25e9f3c9-8396-4669-96f6-ae2770a72e16.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjE0MTU4ODcsIm5iZiI6MTcyMTQxNTU4NywicGF0aCI6Ii81MDkxOTIvMjkzMjEzMTQ5LTI1ZTlmM2M5LTgzOTYtNDY2OS05NmY2LWFlMjc3MGE3MmUxNi5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwNzE5JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDcxOVQxODU5NDdaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1jM2ZkNTQ0MDZhZDFkNTk4YWYwY2FlODNlOTllMTEzNGI0MTkyM2Q3ODg0OGIxZWUzZDg5NzY2MjM3MjI0YzI2JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.2wk4FnsMHimLRT0ETouV-2f7w66uu4omUGVTIEHUZAQ)
We have a lot of existing code and tables and we'd like to be able to use the "old naming scheme" if possible. Is there a way to do that ?
Thanks!
The text was updated successfully, but these errors were encountered: