-
Notifications
You must be signed in to change notification settings - Fork 3.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
Reverse engineering: Scaffold-DbContext can result in invalid SQL for computed column constraint #7918
Comments
@lajones We may have some special handling for this in EF6; you might want to look at it for reference. |
So I would have some tutorial explaining how I could do to debug the EF project code. |
@pablotdv I'm not sure exactly what you are asking, but if you mean building and working with the EF code yourself, then there some instructions here: https://github.com/aspnet/EntityFramework/wiki/Getting-and-Building-the-Code |
Consider trimming the default value at the same time - see discussion in issue 8077 |
Note: we decided not to trim. In fact we are now not interpreting the value we get from the metadata at all - we just put it into the |
Fixed by PR #8217. |
When I run the "Scaffold-DbContext" command on an existing database. I'm having problems with the calculated columns.
The script of my Table
After running the command
Scaffold-DbContext "Server=.\SQLExpress;Database=TestComputedColumn;Trusted_Connection=True;" Microsoft.EntityFrameworkCore.SqlServer -OutputDir Models2
My OnModelCreating was as follows:
Note the attribute HasComputedColumnSql, where I have some missing parentheses.
The correct is HasComputedColumnSql("([Valor]*[Quantidade])/([Percentual]/(100)")
Further technical details
EF Core version: netcoreapp1.1
Database Provider: (e.g. Microsoft.EntityFrameworkCore.SqlServer)
Operating system:
IDE: (e.g. Visual Studio 2017)
The text was updated successfully, but these errors were encountered: