數(shù)據(jù)庫插不進(jìn)數(shù)據(jù)
初始化服務(wù)器那里顯示下面的警告,在初始化方法那里把price做了顯示類型轉(zhuǎn)換也不行還是顯示警告,把noodle類的price類型改成int之后,警告倒是沒有了,但還是插不進(jìn)數(shù)據(jù)
warn: Microsoft.EntityFrameworkCore.Model.Validation[30000]
? ? ? No type was specified for the decimal column 'Price' on entity type 'Noodle'. This will cause values to be silently truncated if they do not fit in the default precision and scale. Explicitly specify the SQL server column type that can accommodate all the values using 'ForHasColumnType()'.
2019-11-29
問題解決了,這個警告是個小問題,https://mattferderer.com/entity-framework-no-type-was-specified-for-the-decimal-column,這里有解決方法,
原來是我的main里面調(diào)用的是Seed(),然后初始化器里面寫的seed(),然后不知道什么時候vs給我創(chuàng)建了一個空Seed(),然后一直調(diào)用的是空Seed(),真的是陰差陽錯,頭疼啊