This is an example/how-to for using Entity Framework & Sqlite with Xenko
- Add EF references to the "project.json" file of the "MyGame.Game" portable library project. See attached.
- Restore NuGet packages.
- Add Nuget Packages "Microsoft.EntityFrameworkCore.Design" and "Microsoft.EntityFrameworkCore.Sqlite" to the "MyGame.Windows" project. (not sure why this is required, Asset Compiler errors otherwise).
- Create your own DbContext similar to example attached. The filename stuff is important.
- Create script to load your DbContext. See "MyDatabaseScript.cs".
- Add database file as a Raw Asset and mark as root so it is included in build.
- Add an entity to scene with a
MyDatabaseScriptcomponent (or similar). - Set the
DatabaseNameproperty of theMyDatabaseScriptcomponent to the name of the database Raw Asset. - ?????
- PROFIT
NOTE: Note sure if you need references to NuGet package "Microsoft.EntityFrameworkCore.Design" in either solution.