Hello,
we are using MS SQL Server and EF Core 3(.1) and ED 6.12.1354.
If a column has a default value in database not matching the type of column, this is not a problem for SQL Server.
E.g. colum is nvarchar(16) and default value is 0 (integer), not '0' (nvarchar). If inserting a new row, the value for that column is set to '0'.
But ED creates that config line with 'ValueGeneratedOnAdd' instead of 'ValueGeneratedNever':
HasColumnType(@"nvarchar(16)").ValueGeneratedOnAdd().HasMaxLength(16).HasDefaultValueSql(@"0");
And does not set the property in code to "0".
I guess this is happening because of differnet types?
Is it possible to have the poperty set to the (converted) default value in the autogenerated code of the entity constructor to get rid of the ValueGeneratedOnAdd?
SQL Server column default value
Re: SQL Server column default value
Thank you for your request. We will investigate the question and notify you about the result.
-
- Posts: 23
- Joined: Tue 27 Feb 2018 13:43
Re: SQL Server column default value
Any update for this?
Re: SQL Server column default value
Thank you for bringing our attention to this request. As of right now, it is hard to provide any possible time frames.
On the other hand, please rest assured that as soon as we have any update on the process we'll let you know immediately.
On the other hand, please rest assured that as soon as we have any update on the process we'll let you know immediately.