ORM 革命 —— 复兴 | ORM Revolution -- Revived




ORM Revolution - Revived

ORM 革命 —— 复兴



Under the flourious business logics, there exists the terrifying vanity.  
在繁华的业务逻辑之下,却是令人感到一丝毛骨悚然的虚无。


Destination 归宿

 The ORM should not have any XML config files or Attribute in business object.
 ORM不应该拥有各种xml配置文件或者业务实体的属性标签。


 The ORM should seperate the Object Schema from Object Data.
 ORM应该分离业务实体结构元数据和业务实体数据。

 The ORM user should not concern the way ORM store the data.
 ORM的用户不应该关注ORM如何对对象进行存储的。

 

Download 下载


 Demo Project:/Files/zc22/Noebe.ORM.Demo.rar
 Demo Database:/Files/zc22/TESTOBJ.rar


 Attention: The demo project is just for TRIAL. Please DO NOT use in commercial purpose.
 注意:        演示项目目前仅用于测试。请不要使用于商业目的。


    class Program
    {
        
static void Main(string[] args)
        {
            NoebeConfiguration config 
= new NoebeConfiguration();
            config.Filename 
= @"e:\temp\TESTOBJ.MDB"//请修改
            config.DatabaseType = Pixysoft.Framework.XSchEmA.DatabaseType.Access;

            OrmManager.Initialize(config);

            Card card 
= new Card();
            card.CardType 
= "Noebe.ORM";

            List
<Email> maillist = new List<Email>();
            
for (int i = 0; i < 10; i++)
            {
                Email mail 
= new Email();
                mail.Address 
= "China" + i;
                maillist.Add(mail);
            }

            Person p 
= new Person();
            p.PersonName 
= "pixysoft";
            p.Card 
= card;
            p.EmailList 
= maillist;


            OrmManager.Instance.Commit(p);

            Card test_card 
= p.Card;

            Console.WriteLine(test_card.CardType);
            Console.WriteLine(p.PersonName);

            List
<Email> test_emaillist = p.EmailList;
            
foreach (Email test_email in test_emaillist)
                Console.WriteLine(test_email.Address);
        }

        
class Card : ObjBase
        {

            
public string CardType
            {
                
get { return null; }
                
set
                {
                }
            }
        }

        
class Email : ObjBase
        {

            
public string Address
            {
                
get { return null; }
                
set { }
            }
        }

        
class Person : ObjBase
        {
            
public string PersonName
            {
                
get { return null; }
                
set { }
            }

            
public Card Card
            {
                
get { return null; }
                
set { }
            }

            
public List<Email> EmailList
            {
                
get { return null; }
                
set { }
            }
        }
    }


 If there is an ORM revolution, we hope it comes from China.
如果有那么一场ORM革命,我希望他来自中国。

To be continued ...
待续 ...


Join us! We need your help!  (NOSU, Non Open Source Union)
加入我们,我们需要您的帮助!(NOSU, 非开源联盟)

Email: reborn_zhang@hotmail.com

Noebe Team
2007 - 10 -22
posted @ 2007-10-22 20:19    阅读(3689)  评论(30编辑  收藏  举报
IT民工