You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If the user creates a model using HasDefaultValueSql(xyz) and the string xyz has line breaks in it, and if the user produces an idempotent SQL script by using Script-Migration -Idemptotent, then extra spaces are added to the value they passed in. E.g. if they call
HasDefaultValueSql("'Don't
GOthis way'")
then the SQL generated will look like this:
IF NOT EXISTS(SELECT*FROM [__EFMigrationsHistory] WHERE [MigrationId] = N'some_migration_identifier')
BEGIN
CREATE TABLE [TestEntity] (
[Id] intNOT NULL IDENTITY,
[Name] nvarchar(max) NULL DEFAULT N'Don''t GO this way',
CONSTRAINT [PK_TestEntity] PRIMARY KEY ([Id])
);
END;
Note that, because of the indentation, extra spaces have been added before 'GO' and 'this way'.
Similarly for HasComputedColumnSql().
But note: there is a workaround - the user can pass the following instead:
Team discussion: consider warning in model validation. (Can warn for any new-line in the SQL; no need to only warn when it is in a literal.) Seems low priority.
If the user creates a model using
HasDefaultValueSql(xyz)
and the string xyz has line breaks in it, and if the user produces an idempotent SQL script by using Script-Migration -Idemptotent, then extra spaces are added to the value they passed in. E.g. if they callthen the SQL generated will look like this:
Note that, because of the indentation, extra spaces have been added before 'GO' and 'this way'.
Similarly for
HasComputedColumnSql()
.But note: there is a workaround - the user can pass the following instead:
The text was updated successfully, but these errors were encountered: