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


C# SQLite.SQLiteConnection.Dispose方法代码示例

本文整理汇总了C#中SQLite.SQLiteConnection.Dispose方法的典型用法代码示例。如果您正苦于以下问题:C# SQLite.SQLiteConnection.Dispose方法的具体用法?C# SQLite.SQLiteConnection.Dispose怎么用?C# SQLite.SQLiteConnection.Dispose使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SQLite.SQLiteConnection的用法示例。


在下文中一共展示了SQLite.SQLiteConnection.Dispose方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Static_InsertSpeed

        public void Static_InsertSpeed()
        {
            var temp = Path.GetTempFileName();
            SQLite.SQLiteConnection conn = new SQLite.SQLiteConnection(temp, true);
            NancyBlackDatabase db = new NancyBlackDatabase(conn);

            for (int i = 0; i < 1000; i++)
            {
                db.UpsertRecord(new TestClass());
            }

            conn.Dispose();
            File.Delete(temp);
        }
开发者ID:aulsai,项目名称:NancyBlack,代码行数:14,代码来源:DatabaseTest.cs

示例2: Static_Delete

        public void Static_Delete()
        {
            var temp = Path.GetTempFileName();
            SQLite.SQLiteConnection conn = new SQLite.SQLiteConnection(temp, true);
            NancyBlackDatabase db = new NancyBlackDatabase(conn);

            var instance = db.UpsertRecord(new TestClass());

            db.DeleteRecord(instance);

            var output = db.GetById<TestClass>(instance.Id);
            Assert.IsTrue(output == null, "DELETE was not success");

            conn.Dispose();
            File.Delete(temp);
        }
开发者ID:aulsai,项目名称:NancyBlack,代码行数:16,代码来源:DatabaseTest.cs

示例3: Static_Query

        public void Static_Query()
        {
            var temp = Path.GetTempFileName();
            SQLite.SQLiteConnection conn = new SQLite.SQLiteConnection(temp, true);
            NancyBlackDatabase db = new NancyBlackDatabase(conn);

            var instance = new TestClass();
            instance.Name = "Test Query";

            db.UpsertRecord(instance);

            var check = db.Query<TestClass>().Where(i => i.Name == "Test Query").FirstOrDefault();

            Assert.IsTrue(check.Name == "Test Query", "Query got wrong item");

            conn.Dispose();
            File.Delete(temp);
        }
开发者ID:aulsai,项目名称:NancyBlack,代码行数:18,代码来源:DatabaseTest.cs

示例4: Static_Insert

        public void Static_Insert()
        {
            var temp = Path.GetTempFileName();
            SQLite.SQLiteConnection conn = new SQLite.SQLiteConnection(temp, true);
            NancyBlackDatabase db = new NancyBlackDatabase(conn);

            var instance = db.UpsertRecord(new TestClass());
            Assert.IsTrue(instance.Id > 0, "ID was not set");
            Assert.IsTrue(instance.__createdAt != DateTime.MinValue, "__createdAt was not set");
            Assert.IsTrue(instance.__updatedAt != DateTime.MinValue, "__updatedAt was not set");
            Assert.IsTrue(instance.__version != null, "Version was not set");

            var instance2 = db.UpsertRecord(new TestClass());
            Assert.IsTrue(instance2.Id > instance.Id, "ID was not running");

            conn.Dispose();
            File.Delete(temp);
        }
开发者ID:aulsai,项目名称:NancyBlack,代码行数:18,代码来源:DatabaseTest.cs

示例5: Static_Update

        public void Static_Update()
        {
            var temp = Path.GetTempFileName();
            SQLite.SQLiteConnection conn = new SQLite.SQLiteConnection(temp, true);
            NancyBlackDatabase db = new NancyBlackDatabase(conn);

            var instance = db.UpsertRecord(new TestClass());
            instance.Name = "Test Update";

            db.UpsertRecord(instance);

            var check = db.GetById<TestClass>(instance.Id);

            Assert.IsTrue(check.Name == "Test Update", "UPDATE was not success");

            conn.Dispose();
            File.Delete(temp);
        }
开发者ID:aulsai,项目名称:NancyBlack,代码行数:18,代码来源:DatabaseTest.cs


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