EFCore CodeFirst 產生資料庫可能常遇到的怪問題_More than one DbContext was found._An error occurred using the connection to database

 


More than one DbContext was found. Specify which one to use. Use the '-Context' parameter for PowerShell commands and the '--context' parameter for dotnet commands.

這代表專案可能包含兩種資料庫上下文的Class (繼承自DbContext的衍生類別)

若專案有用到Identity也算一種
這時就要多串-context 指定相應DbContext子類名稱









An error occurred using the connection to database '{資料庫名稱}' on server 'localhost'.
這代表資料庫連線配置錯誤喔!!













留言

這個網誌中的熱門文章

經得起原始碼資安弱點掃描的程式設計習慣培養(五)_Missing HSTS Header

經得起原始碼資安弱點掃描的程式設計習慣培養(三)_7.Cross Site Scripting(XSS)_Stored XSS_Reflected XSS All Clients

(2021年度)駕訓學科筆試準備題庫歸納分析_法規是非題