【開源系列】三國演義LBS (八)源碼:核心架構:資料庫建模

來源:互聯網
上載者:User

前言

-----------------------------------------------

相關討論群組入口: http://www.pixysoft.net/ (點擊進入)

  

 

 

功能簡介:

-----------------------------------------------   

功能強大到無法想象!!!!

1. 擷取資料庫中繼資料,進行建模

2. 對資料庫表結構等進行修改

3. 任意資料庫表結構進行變換,什麼資料庫在我面前都是透明的!

 

快速入門

 

-----------------------------------------------   

 

using System;
using System.Collections.Generic;
using System.Text;
using Pixysoft.Framework.XSchEmA.Entity;

namespace Pixysoft.Framework.XSchEmA.testdriven
{
    class quickstart
    {
        /// <summary>
        /// 建立資料庫
        /// </summary>
        public void test_001()
        {
            XSchemaManager.AccessSchema.Schema.CreateDatabase(null, AppDomain.CurrentDomain.BaseDirectory + "\\helloworld.mdb");
        }

        /// <summary>
        /// 建立表結構
        /// 少用,一般xml直接產生、或者從資料庫直接擷取表結構。
        /// </summary>
        public void test_002()
        {
            //初始化資料庫連結資訊
            DatabaseInfo info = new DatabaseInfo();
            info.Filename = AppDomain.CurrentDomain.BaseDirectory + "\\helloworld.mdb";
            info.DatabaseType = DatabaseType.Access;

            //手動初始化表結構
            DatabaseSchema db = new DatabaseSchema(info);
            TableSchema table = new TableSchema("HELLO");
            table.Columns.Add(new ColumnSchema("HELLO", "COLUMN1", new DataTypeSchema("TEXT")));
            db.Tables.Add(table);
            db.PrimaryKeys.Add(new PrimaryKeySchema("HELLO_PK", "HELLO", "COLUMN1"));
            db.Build();

            //部署
            XSchemaManager.AccessSchema.Schema.Commit(info, db);
        }

        /// <summary>
        /// 擷取表結構
        /// </summary>
        public void test_003()
        {
            //初始化資料庫連結資訊
            DatabaseInfo info = new DatabaseInfo();
            info.Filename = AppDomain.CurrentDomain.BaseDirectory + "\\helloworld.mdb";
            info.DatabaseType = DatabaseType.Access;

            DatabaseSchema schema = XSchemaManager.AccessSchema.Schema.GetSchema(info);
            Console.WriteLine(schema.Tables[0].TableName);
        }
    }

 

 

支援MySQL, SQL Server, Oracle, Access, SQLite. 你想用什麼資料庫,就用什麼資料庫!

 

 

下期預告:

-----------------------------------------------    

Pixysoft.Framework.Noebe

對資料庫進行無差別的操作!!什麼叫做恐怖的敏捷?這個就是!

 

附件下載

-----------------------------------------------    

Pixysoft.Framework.XSchEmA 打包下載

 

http://www.boxcn.net/shared/pj7ved6cpg


SVN:

http://qun.qq.com/air/#95755843/bbs    

 

 

 

 

 

 

 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.