数据源在哪里=MvcMovie.db?
Where is Data Source=MvcMovie.db?
我正在按照上述教程尝试使用 Visual Studio 代码来创建 Razor 页面,我确实设法 运行 成功地为 Movie 模型执行 CRUD。当我看到appsettings.json时,我是什么困惑,它有
"ConnectionStrings": {
"MovieContext": "Data Source=MvcMovie.db"
我的问题是,我上面配置的数据库在哪里?它看起来与我的 Visual Studio 社区 IDE 非常不同。我知道一个是 xml,另一个是 JSON。但是这个 JSON 数据源没有指定哪个 sql 实例名称?
在启动class中,你会在方法ConfigureServices
中看到类似这样的东西
services.AddDbContext<RazorPagesMovieContext>(options =>
options.UseSqlite(
// This is one way to get your connection from the appsettings.json
// the result of this call is: "Data Source=MvcMovie.db"
Configuration.GetConnectionString("MovieContext"))
);
我正在按照上述教程尝试使用 Visual Studio 代码来创建 Razor 页面,我确实设法 运行 成功地为 Movie 模型执行 CRUD。当我看到appsettings.json时,我是什么困惑,它有
"ConnectionStrings": { "MovieContext": "Data Source=MvcMovie.db"
我的问题是,我上面配置的数据库在哪里?它看起来与我的 Visual Studio 社区 IDE 非常不同。我知道一个是 xml,另一个是 JSON。但是这个 JSON 数据源没有指定哪个 sql 实例名称?
在启动class中,你会在方法ConfigureServices
中看到类似这样的东西
services.AddDbContext<RazorPagesMovieContext>(options =>
options.UseSqlite(
// This is one way to get your connection from the appsettings.json
// the result of this call is: "Data Source=MvcMovie.db"
Configuration.GetConnectionString("MovieContext"))
);