【开源系列】三国演义LBS (八)源码:核心框架:数据库建模

前言

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

相关讨论组入口: 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 打包下载

 


SVN:

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

 

 

 

 

 

 

 

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

 

精灵软件 火热讨论组

192700436点击这里加入此群

95755843 [满]

posted @ 2011-05-05 23:57 阅读(375) 评论(5) 编辑 收藏

 回复 引用 查看   
#1楼2011-05-06 08:14 | シ.xw.伟ゞ      
幸苦啊!!!
 回复 引用 查看   
#2楼2011-05-06 09:54 | zanewin      
辰哥说的太NX了
 回复 引用 查看   
#3楼2011-05-06 23:12 | 温景良(Jason)      
辛苦了,推荐一下是必须的
 回复 引用 查看   
#4楼2012-01-20 20:37 | condos in hyde park      
The post is absolutely fantastic! A lot a lot of information and inspiration, both of which we all need! Also, I admire the time and effort you have made your blog and detailed information on the offer! I am going to bookmark your blog and have my children check here often.
<a href="http://www.chicagorealestatedream.com/buying-condos-in-hyde-park/">condos in hyde park</a>

 回复 引用 查看   
#5楼2012-01-20 20:38 | condos in hyde park      
condos in hyde park
Well...This is nice post even the whole blog is rocking…I like this blog and recommend this blog to those people who are interested in reading some nice stuff…Guys you doing great...Please keep it up.

IT民工