我正在试验 Maui Blazor。我想将我的应用程序与 SQL 服务器数据库连接起来。因此我使用了一个简单的 Sql 连接字符串。当我用“普通 Windows 机器”测试它时没有问题,但是当我想在 android 模拟器上测试它时它不起作用。
我使用了“scaffold-DBContext ..”命令并在生成的方法中有我的连接字符串:
...
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
if (!optionsBuilder.IsConfigured)
{
var sqlConnectionString = ...;
//#warning To protect potentially sensitive information in your connection string, you should move it out of source code. You can avoid scaffolding the connection string by using the Name= syntax to read it from configuration - see https://go.microsoft.com/fwlink/?linkid=2131148. For more guidance on storing connection strings, see http://go.microsoft.com/fwlink/?LinkId=723263.
optionsBuilder.UseSqlServer(sqlConnectionString);
}
...
我该怎么做才能在android模拟器上运行?我在“OnConfiguring”方法中的断点甚至没有被命中(使用 Android)。
(也许有人知道它为什么不起作用?)
非常感谢您提前