当前位置: 首页>>代码示例>>C#>>正文


C# DbContextOptions.UseSQLite方法代码示例

本文整理汇总了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);
        }
开发者ID:llenroc,项目名称:AwfulMetro,代码行数:7,代码来源:FavoriteForumContext.cs

示例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);
        }
开发者ID:Nyaoso,项目名称:EntityFramework,代码行数:9,代码来源:SQLiteDbContextOptionsExtensionsTest.cs

示例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);
        }
开发者ID:Nyaoso,项目名称:EntityFramework,代码行数:10,代码来源:SQLiteDbContextOptionsExtensionsTest.cs

示例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);
        }
开发者ID:Nyaoso,项目名称:EntityFramework,代码行数:10,代码来源:SQLiteDbContextOptionsExtensionsTest.cs

示例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);
        }
开发者ID:rowanmiller,项目名称:Demo-EF7,代码行数:12,代码来源:GameContext.cs

示例6: OnConfiguring

 protected override void OnConfiguring(DbContextOptions options)
 {
     var connection = "Filename=GameHistory.db";
     options.UseSQLite(connection);
 }
开发者ID:rowanmiller,项目名称:Demo-dotnetConf2014,代码行数:5,代码来源:GameContext.cs


注:本文中的DbContextOptions.UseSQLite方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。