Using Entity Framework 5 and EF Core Power Tools (whith the setting to generate ef 5 code enabled) we get something like the following code generated for each computed column:
...HasComputedColumnSql("([LastName]+isnull(' '+[FirstName],''))", true);
which is perfectly right.
Unfortunately, trying to create a new entity that has computed columns and trying to save we get the following exception from ef core 5:
The column '...' cannot be modified because it is either a computed column or is the result of a UNION operator
When manualy appending the ValueGeneratedOnAddOrUpdate
after the HasComputedColumnSql
like so:
...HasComputedColumnSql("([LastName]+isnull(' '+[FirstName],''))", true).ValueGeneratedOnAddOrUpdate();
everything works fine.
According to the docs this should be automatically be called by HasComputedColumnSql
.
What can be done to overcome this issue ?
We are using Microsoft.EntityFrameworkCore v5.0.5 package and also we are using an Azure Managed Sql Server Instance