本文整理汇总了C#中DbContextOptions.UseSQLite方法的典型用法代码示例。如果您正苦于以下问题:C# DbContextOptions.UseSQLite方法的具体用法?C# DbContextOptions.UseSQLite怎么用?C# DbContextOptions.UseSQLite使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DbContextOptions
的用法示例。
在下文中一共展示了DbContextOptions.UseSQLite方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnConfiguring
protected override void OnConfiguring(DbContextOptions builder)
{
var dir = Windows.Storage.ApplicationData.Current.LocalFolder.Path;
var connection = "Filename=" + System.IO.Path.Combine(dir, "FavoriteForum.db");
builder.UseSQLite(connection);
}
示例2: UseSQLite_throws_if_options_are_locked
public void UseSQLite_throws_if_options_are_locked()
{
var options = new DbContextOptions<DbContext>();
options.Lock();
Assert.Equal(
GetString("FormatEntityConfigurationLocked", "UseSQLite"),
Assert.Throws<InvalidOperationException>(() => options.UseSQLite("Database=DoubleDecker")).Message);
}
示例3: Can_add_extension_with_connection_string_using_generic_options
public void Can_add_extension_with_connection_string_using_generic_options()
{
var options = new DbContextOptions<DbContext>();
options = options.UseSQLite("Database=Whisper");
var extension = ((IDbContextOptionsExtensions)options).Extensions.OfType<SQLiteOptionsExtension>().Single();
Assert.Equal("Database=Whisper", extension.ConnectionString);
}
示例4: Can_add_extension_with_connection_string
public void Can_add_extension_with_connection_string()
{
var options = new DbContextOptions();
options = options.UseSQLite("Database=Crunchie");
var extension = ((IDbContextOptionsExtensions)options).Extensions.OfType<SQLiteOptionsExtension>().Single();
Assert.Equal("Database=Crunchie", extension.ConnectionString);
}
示例5: OnConfiguring
protected override void OnConfiguring(DbContextOptions options)
{
#if WINDOWS_PHONE_APP
var connection = "Filename=GameHistory.db";
#else
var dir = Windows.Storage.ApplicationData.Current.LocalFolder.Path;
var connection = "Filename=" + System.IO.Path.Combine(dir, "GameHistory.db");
#endif
options.UseSQLite(connection);
}
示例6: OnConfiguring
protected override void OnConfiguring(DbContextOptions options)
{
var connection = "Filename=GameHistory.db";
options.UseSQLite(connection);
}