LoginSignup
0
0

More than 1 year has passed since last update.

Entity Framework Coreで"You need to call SQLitePCL.raw.SetProvider(). が発生したときの解決方法"

Posted at

久しぶりの投稿。

問題発生ケース

環境
OS:Windows11
IDE:Visual Studio2022 Windows Form .Net7

Entity Frameworkのチュートリアルを進めていたところ、下記の場所でエラーが発生した。
"You need to call SQLitePCL.raw.SetProvider(). If you are using a bundle package, this is done by calling SQLitePCL.Batteries.Init()".

c# sample.cs
dbContext.Database.EnsureCreated();

対応方法

パッケージマネージャーで下記の通り実行。

PM> install-package system.data.sqlite
PM> uninstall-package system.data.sqlite
PM> install-package microsoft.entityframeworkcore.sqlite

リビルド実行後、再度実行するとエラーは発生しなくなった。

参考ページ

以上

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0