We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
When I try to add
modelBuilder.Entity(entity)Property(x=>x.UniqueRecordId).HasColumnType("NVARCHAR(4000) COLLATE SQL_Latin1_General_CP1_CS_AS")
to my model builder my migration will add this line:
migrationBuilder.CreateTable( name: "ObjectIds", columns: table => new { Id = table.Column<long>(type: "bigint", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), ObjectId = table.Column<string>(type: "nvarchar(max)", nullable: true), ModificationDateTime = table.Column<DateTime>(type: "datetime2", nullable: false), CreationDateTime = table.Column<DateTime>(type: "datetime2", nullable: false), Key = table.Column<string>(type: "nvarchar(450)", nullable: true), UniqueRecordId = table.Column<string>(type: "NVARCHAR COLLATE SQL_Latin1_General_CP1_CS_AS(4000)", nullable: true), IsDeleted = table.Column<bool>(type: "bit", nullable: false) }, constraints: table => { table.PrimaryKey("PK_ObjectIds", x => x.Id); });
But the generated code is not valid. instead of this line:
UniqueRecordId = table.Column<string>(type: "NVARCHAR COLLATE SQL_Latin1_General_CP1_CS_AS(4000)", nullable: true),
Must changed to:
UniqueRecordId = table.Column<string>(type: "NVARCHAR(4000) COLLATE SQL_Latin1_General_CP1_CS_AS", nullable: true),
To works for Update-Database.
EF Core version: Database provider: (e.g. Microsoft.EntityFrameworkCore.SqlServer) Target framework: (e.g. .NET 5.0.2) Operating system: IDE: (e.g. Visual Studio 2019 16.9.1)
The text was updated successfully, but these errors were encountered:
Rather than specifying the collation as part of the column type, have you tried using the dedicated EF API for specifying the collation separately?
Sorry, something went wrong.
@roji Thank you this way working, but ew problem I got and I think it's a bug. After add migration I see this code:
migrationBuilder.AlterDatabase(, oldCollation: "SQL_Latin1_General_CP1_CI_AS");
I changed it to:
migrationBuilder.AlterDatabase(null, oldCollation: "SQL_Latin1_General_CP1_CI_AS");
And It's fixed now.
@Ali-YousefiTelori that looks like #23794, which was fixed in 5.0.2. It's always recommended to use the latest patch version.
No branches or pull requests
When I try to add
to my model builder my migration will add this line:
But the generated code is not valid.
instead of this line:
Must changed to:
To works for Update-Database.
EF Core version:
Database provider: (e.g. Microsoft.EntityFrameworkCore.SqlServer)
Target framework: (e.g. .NET 5.0.2)
Operating system:
IDE: (e.g. Visual Studio 2019 16.9.1)
The text was updated successfully, but these errors were encountered: