I create a Model on .net core 2.1 called Product.I made all the necessary to make it work(add DbContext, make connection string, make the service) and when I Add-Migration Initial I get the following: PM> add-migration initial
Microsoft.EntityFrameworkCore.Infrastructure[10403]
Entity Framework Core 2.1.11-servicing-32099 initialized 'ApplicationDbContext' using provider 'Microsoft.EntityFrameworkCore.SqlServer' with options: None
An operation was scaffolded that may result in the loss of data. Please review the migration for accuracy.
Then I update-database and I get:
Failed executing DbCommand (2ms) [Parameters=[], CommandType='Text', CommandTimeout='30']
CREATE TABLE [Products] (
[ProductID] int NOT NULL IDENTITY,
[Name] nvarchar(max) NULL,
[Description] nvarchar(max) NULL,
[Category] nvarchar(max) NULL,
[Price] decimal(18,2 NOT NULL,
CONSTRAINT [PK_Products] PRIMARY KEY ([ProductID])
);
System.Data.SqlClient.SqlException (0x80131904): Incorrect syntax near the keyword 'NOT'.
Further technical details EF Core version: 2.1 Database Provider: sqlserver Operating system: windows 10 64bit IDE: 2019 Any suggestion?
User contributions licensed under CC BY-SA 3.0