我刚刚使用命令dotnet new angular -o <output_directory_name> -au Individual和脚手架标识创建了项目,然后我安装了 Microsoft.EntityFrameworkCore.SqlServer 但是当我运行命令 update-database 时,我收到以下错误。
Failed executing DbCommand (4ms) [Parameters=[], CommandType='Text', CommandTimeout='30']
CREATE TABLE [AspNetRoles] (
[Id] TEXT NOT NULL,
[Name] TEXT(256) NULL,
[NormalizedName] TEXT(256) NULL,
[ConcurrencyStamp] TEXT NULL,
CONSTRAINT [PK_AspNetRoles] PRIMARY KEY ([Id])
);
Run Code Online (Sandbox Code Playgroud)
然后在最后结束另一个错误
错误编号:2716,状态:1,类别:16
列、参数或变量 #2:无法在数据类型文本上指定列宽。
下面是生成的CreateIdentitySchema迁移
migrationBuilder.CreateTable(
name: "AspNetRoles",
columns: table => new
{
Id = table.Column<string>(nullable: false),
Name = table.Column<string>(maxLength: 256, nullable: true),
NormalizedName = table.Column<string>(maxLength: 256, nullable: true),
ConcurrencyStamp = table.Column<string>(nullable: true)
},
constraints: …Run Code Online (Sandbox Code Playgroud) 以下是一个代码,如果CategoryId相同,则将金额相加并创建一个新的line itemper CategoryId。
self.OriginalLineItems = [
{ CategoryId: 'Cat1', Amount: 15, Type: 'TypeA' },
{ CategoryId: 'Cat1', Amount: 30, Type: 'TypeA' },
{ CategoryId: 'Cat1', Amount: 20, Type: 'TypeB' },
{ CategoryId: 'Cat2', Amount: 10, Type: 'TypeA' },
{ CategoryId: 'Cat2', Amount: 5, Type: 'TypeB' }]
self.newLineItems = [];
self.OriginalLineItems.forEach(function (o) {
if (!this[o.CategoryId]) {
this[o.CategoryId] = { CategoryId: o.CategoryId, Amount: 0, Type: o.Type };
self.newLineItems.push(this[o.CategoryId]);
}
this[o.CategoryId].Amount += o.Amount;
}, Object.create(null));
Run Code Online (Sandbox Code Playgroud)
这将导致以下数组:
self.newLineItems = …Run Code Online (Sandbox Code Playgroud)