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


C# DB.GetConfig方法代码示例

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


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

示例1: init

		public static void init (String path, bool isVM)
		{

			Console.WriteLine ("DBPath=" + path);

			DB.Root (path);
		 
			DB server = new DB (1);
			if (isVM) {
				server.GetConfig ().DBConfig.CacheLength
                = server.GetConfig ().DBConfig.MB (16);
			} else {
				server.GetConfig ().DBConfig.CacheLength
					= server.GetConfig ().DBConfig.MB (512);
			}
			server.GetConfig ().DBConfig.SwapFileBuffer
				= (int)server.GetConfig ().DBConfig.MB (4);
			server.GetConfig ().DBConfig.FileIncSize
				= (int)server.GetConfig ().DBConfig.MB (16);
			new Engine ().Config (server.GetConfig ().DBConfig);
			server.GetConfig ().EnsureTable<Page> ("Page", "id");
			server.GetConfig ().EnsureIndex<Page> ("Page", true, "url(" + Page.MAX_URL_LENGTH + ")");

			search_db = server.Open ();

		}
开发者ID:iboxdb,项目名称:ftserver-cs,代码行数:26,代码来源:FTS.cs

示例2: iBoxTestCreateTable

        public void iBoxTestCreateTable()
        {
            var path = "ibox";
            if (!Directory.Exists(path))
                Directory.CreateDirectory(path);

            using (var server = new DB(path))
            {
                var config = server.GetConfig();
                config.EnsureTable<Book>(TableName.Books, "id");
                var db = server.Open();
                Assert.IsTrue (db != null);
            }
        }
开发者ID:ss22219,项目名称:Booker,代码行数:14,代码来源:iBoxTest.cs

示例3: UserTestGetData

        public void UserTestGetData()
        {
            var path = "ibox";
            if (!Directory.Exists(path))
                Directory.CreateDirectory(path);

            using (var server = new DB(path))
            {
                var config = server.GetConfig();
                config.EnsureTable<User>(TableName.Users, "username");
                var db = server.Open();
                Booker.Database.Interface.IUserDb userDb = new UserDb(db) as IUserDb;
                var user = userDb.Get("gool");

            }
        }
开发者ID:ss22219,项目名称:Booker,代码行数:16,代码来源:UserTest.cs

示例4: iBoxTestInsertData

        public void iBoxTestInsertData()
        {
            var path = "ibox";
            if (!Directory.Exists(path))
                Directory.CreateDirectory(path);

            using (var server = new DB(path))
            {
                var config = server.GetConfig();
                config.EnsureTable<Book>(TableName.Books, "id");
                var db = server.Open();

                db.Insert<Book>(TableName.Books, new Book()
                {
                    id = "1",
                    name = "book1"
                });
            }
        }
开发者ID:ss22219,项目名称:Booker,代码行数:19,代码来源:iBoxTest.cs

示例5: ChapterTestInsertData

        public void ChapterTestInsertData()
        {
            var path = "ibox";
            if (!Directory.Exists(path))
                Directory.CreateDirectory(path);

            using (var server = new DB(path))
            {
                var config = server.GetConfig();
                config.EnsureTable<Chapter>(TableName.Chapters, "id");
                var db = server.Open();
                var chapterDb = new ChapterDb(db);
                chapterDb.Add(new Chapter()
                {
                    id = "1",
                    name = "chapter1",
                    bookid = "1"
                });
                chapterDb.Delete("1");
            }
        }
开发者ID:ss22219,项目名称:Booker,代码行数:21,代码来源:ChapterTest.cs

示例6: iBoxTestFindData

        public void iBoxTestFindData()
        {
            var path = "ibox";
            if (!Directory.Exists(path))
                Directory.CreateDirectory(path);

            using (var server = new DB(path))
            {
                var config = server.GetConfig();
                config.EnsureTable<Book>(TableName.Books, "id");
                var db = server.Open();

                var book = db.SelectKey<Book>(TableName.Books, "1");
                if (book == null) {
                    db.Insert<Book> (TableName.Books, new Book () {
                        id = "1",
                        name = "book1"
                    });
                }
                book = db.SelectKey<Book>(TableName.Books, "1");
                Assert.AreNotEqual(book, null);
            }
        }
开发者ID:ss22219,项目名称:Booker,代码行数:23,代码来源:iBoxTest.cs

示例7: init

        public static void init(String path)
        {
            Console.WriteLine ("DBPath=" + path);

            DB.Root (path);

            DB server = new DB (1);
            /*
            server.GetConfig().DBConfig.CacheLength
                = server.GetConfig().DBConfig.MB(8);
             */
            server.GetConfig ().DBConfig.SwapFileBuffer
                = (int)server.GetConfig ().DBConfig.MB (2);
            new Engine ().Config (server.GetConfig ().DBConfig);
            server.GetConfig ().EnsureTable<Page> ("Page", "id");
            server.GetConfig ().EnsureIndex<Page> ("Page", true, "url(100)");

            search_db = server.Open ();
        }
开发者ID:blake2002,项目名称:ftserver-cs,代码行数:19,代码来源:FTS.cs

示例8: iBoxTestRemoveData

        public void iBoxTestRemoveData()
        {
            var path = "ibox";
            if (!Directory.Exists(path))
                Directory.CreateDirectory(path);

            using (var server = new DB(path))
            {
                var config = server.GetConfig();
                config.EnsureTable<Book>(TableName.Books, "id");
                var db = server.Open();

                db.Delete(TableName.Books, "1");

                var book = db.SelectKey<Book>(TableName.Books, "1");
                Assert.AreEqual(book, null);
            }
        }
开发者ID:ss22219,项目名称:Booker,代码行数:18,代码来源:iBoxTest.cs

示例9: test_main_big

        public static void test_main_big()
        {
            DB.Root ("/tmp/");

            iBoxDB.DBDebug.DDebug.DeleteDBFiles (1);
            DB db = new DB (1);

            String[] ts = new String[] {
                File.OpenText(System.Environment.GetFolderPath (Environment.SpecialFolder.Personal) +
                              "/hero.txt").ReadToEnd()
            };

            Engine engine = new Engine ();
            engine.Config (db.GetConfig ().DBConfig);

            AutoBox auto = db.Open ();

            var b = DateTime.Now;
            for (int i = 0; i < ts.Length; i++) {
                using (var box = auto.Cube()) {
                    engine.indexText (box, i, ts [i], false);
                    box.Commit ().Assert ();
                }
            }
            Console.WriteLine ("Index " + (DateTime.Now - b).TotalSeconds);
            var strkw = "黄蓉";

            b = DateTime.Now;
            int c = 0;
            for (int i=0; i<20; i++) {
                b = DateTime.Now;
                c = 0;
                using (var box = auto.Cube()) {
                    foreach (KeyWord kw in engine.search(box, strkw)) {
                        c++;
                    }
                }
                Console.WriteLine (c + " , " + (DateTime.Now - b).TotalSeconds);
            }

            b = DateTime.Now;
            c = 0;
            int p = ts [0].IndexOf (strkw);
            while (p > 0) {
                c++;
                p = ts [0].IndexOf (strkw, p + 2);
            }
            Console.WriteLine (c + " , " + (DateTime.Now - b).TotalSeconds);

            auto.GetDatabase ().Close ();
        }
开发者ID:blake2002,项目名称:ftserver-cs,代码行数:51,代码来源:EngineTest.cs

示例10: test_main

        public static void test_main()
        {
            DB.Root ("/tmp/");

            iBoxDB.DBDebug.DDebug.DeleteDBFiles (1);
            DB db = new DB (1);

            String[] ts = new String[] {
                //ID=0
                "Setting up Git\n"
                + "\n"
                + "Download and install the latest version of GitHub Desktop. "
                + "This will automatically install Git and keep it up-to-date for you.\n"
                + "On your computer, open the Git Shell application.\n"
                + "Tell Git your name so your commits will be properly labeled. Type everything after the $ here:\n"
                + "\n babies "
                + "git config --global user.name \"YOUR NAME\"\n"
                + "Tell Git the email address that will be associated with your Git commits. "
                + "The email you specify should be the same one found in your email settings. "
                + "To keep your email address hidden,"
                + " 关于 see \"Keeping your C# Java NoSQL email address [email protected] private\".",
                //ID=1
                "关于版本控制\n"
                + "什么是“版本控制”?我为什么要关心它呢? 版本控制是一种记录一个或若干文件内容变化,1234567890ABCDEFGH "
                + "以便将来查阅特定版本修订情况的系统。 在本书所展示的例子中,我们对保存着软件源代码的文件作版本控制,"
                + "但实际上,C lang IT 你可以对任何类型的文件进行版本控制。",
                //ID=2
                "バージョン管理に関して\n"
                + "\n"
                + "「バージョン管理」とは何でしょうか。また、なぜそれを気にする必要があるのでしょうか。 "
                + "バージョン管理とは、一つのファイルやファイルの集合に対して時間とともに加えられていく変更を記録するシステムで、"
                + "後で特定バージョンを呼び出すことができるようにするためのものです。"
                + " 本書の例では、バージョン管理されるファイルとしてソフトウェアのソースコードを用いていますが、"
                + "実際にはコンピューター上のあらゆる種類のファイルをバージョン管理のもとに置くことができます。",
                //ID=3
                "關於版本控制\n"
                + "什麼是版本控制? 以及為什麼讀者會在意它? "
                + "版本控制是一個能夠記錄一個或一組檔案在某一段時間的變更,"
                + "使得讀者以後能取回特定版本的系統。 NoSQL"
                + "在本書的範例中,讀者會學到如何對軟體的原始碼做版本控制。"
                + " 即使實際上讀者幾乎可以針對電腦上任意型態的檔案做版本控制。",
                //ID=4
                "Git 简史\n"
                + "同生活中的许多伟大事物一样,Git 诞生于一个极富纷争大举创新的年代。nosql \n"
                + "\n"
                + "Linux 内核开源项目有着为数众广的参与者。 绝大多数的 Linux 内核维护工作都花在了提交补丁和保存归档的"
                + "繁琐事务上(1991-2002年间)。 到 2002 年,"
                + "整个项目组开始启用一个专有的分布式版本控制系统 BitKeeper 来管理和维护代码。\n"
                + "\n"
                + "到了 2005 年,开发 BitKeeper 的商业公司同 Linux 内核开源社区的合作关系结束,"
                + "他们收回了 Linux 内核社区免费使用 BitKeeper 的权力。"
                + " 这就迫使 Linux 开源社区(特别是 Linux 的缔造者 Linux Torvalds)基于使用 BitKcheper 时的"
                + "经验教训,开发出自己的版本系统。 他们对新的系统制订了若干目标:"
            };

            Engine engine = new Engine ();
            engine.Config (db.GetConfig ().DBConfig);

            AutoBox auto = db.Open ();

            for (int i = 0; i < ts.Length; i++) {
                using (var box = auto.Cube()) {
                    engine.indexText (box, i, ts [i], false);
                    box.Commit ().Assert ();
                }
            }

            using (var box = auto.Cube()) {
                //engine.indexText(box, 4, ts[4], true);
                box.Commit ().Assert ();
            }

            using (var box = auto.Cube()) {
                // searchDistinct() search()
                foreach (KeyWord kw in engine.search(box, "nosql 经验 git ")) {
                    Console.WriteLine (kw.ToFullString ());
                    Console.WriteLine (engine.getDesc (ts [(int)kw.ID], kw, 20));
                }
            }

            auto.GetDatabase ().Close ();
        }
开发者ID:blake2002,项目名称:ftserver-cs,代码行数:82,代码来源:EngineTest.cs

示例11: iBoxDBBackedTest

 public iBoxDBBackedTest()
 {
     var server = new DB();
     server.GetConfig().EnsureTable<Author>(DBTableNames.Authors, "Id");
     _db = server.Open();
 }
开发者ID:iloveyouzlw,项目名称:MZBlog,代码行数:6,代码来源:iBoxDBBackedTest.cs


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