The order of calls for ValueGeneratedOnAddOrUpdate, HasDefaultValueSql
Depending on the order of calls a get different results for generated migrations.
Example. RecordVersion is the property with DateTime type.
This setup
ie.Property(e => e.RecordVersion) .HasDefaultValueSql("GetDate()") .ValueGeneratedOnAddOrUpdate();
results in this column definition:
[RecordVersion] AS GetDate()
This setup
ie.Property(e => e.RecordVersion) .ValueGeneratedOnAddOrUpdate() .HasDefaultValueSql("GetDate()");
results in this column definition
[RecordVersion] datetime2 NOT NULL DEFAULT (GetDate())
Does it the right behaviour? I prefer the second one. Update on the column I'm going to make with the trigger. Also, the second case allows me to put an index on the column, and the first one doesn't.
Used libraries are: "EntityFramework.Core": "7.0.0-rc1-final", "EntityFramework.MicrosoftSqlServer": "7.0.0-rc1-final", "EntityFramework.Commands": "7.0.0-rc1-final".
dupe of #4328 Already fixed in latest and will be shipped in RC2 release