【发布时间】:2019-05-08 19:47:16
【问题描述】:
我似乎无法将参数传递给 sqlite 连接字符串...
如果我这样做:
public class MyDbContext : DbContext {
public DbSet<MyData> MyData { get; set; }
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) {
optionsBuilder.UseSqlite("Data Source=C:\\src\\mydb.db;");
}
}
一切正常。但是,如果我将其更改为:
optionsBuilder.UseSqlite("Data Source=C:\\src\\mydb.db;Version=3;");
然后查询抛出System.ArgumentException: 'Keyword not supported: 'version'.'
或者如果我将其更改为:
optionsBuilder.UseSqlite("Data Source=C:\\src\\mydb.db;Read Only=True;");
然后查询抛出System.ArgumentException: 'Keyword not supported: 'read only'.'
这里有什么问题?如何将 ie read only 传递给 sqlite?
【问题讨论】:
-
您使用的是什么数据库提供商?
-
我如何知道我使用的是哪个提供商??我没有 Microsoft.Data.Sqlite 的任何 using 语句......我只是使用了 UseSqlite()
标签: c# entity-framework sqlite entity-framework-6