IBatisNet+Castle構架開發指南

來源:互聯網
上載者:User


從本質上來說iBATIS不能算是一種orm工具,只是一個DataMapper。
我們甚至可以把它看成一個SQL產生工具,也就是對 ADO.net 中 IDbCommand 和 IDataParameter 的一個XML格式化的配置,SqlMap是IbatisNet 的一個亮點。

從使用上看,IbatisNet 也具有ORM的某些特點,很方便的在實體和資料庫之間相互操作
從構架上看,IbatisNet 不像NHibernate 享有資料庫的完全控制權,也給我們擴充提供餘地
從效能上看,IbatisNet 應該比ORM有優勢,而且SQL語句是開放的,可最佳化的。

什麼時候使用IbatisNet  什麼時候使用NHibernate
我們看看IbatisNet 作者的原話

If you are starting a new project and you're in full control of your object model and database design, NHibernate is a good choice of O/R tool.
If you are accessing any 3rd party databases (e.g. vendor supplied), or you're working with a legacy database, or even just a really poorly designed database, then an O/R mapper might not be capable of handling the situation. That's were an SQL Mapper comes in handy

既然寫的是開發指南,我就不過多的涉及IbatisNet 實現原理

總體上講IbatisNet  是我比較喜歡一套構架 已經在幾個實踐項目應用過

如果用Castle的ICO作為業務容器 和用Castle的交易處理機制,將會有珠聯壁合的感覺

先放上一個完整的Demo
===============================================================

IBatisNetDemo

DateBase.sql 為示列資料庫角本
將為你建立 Demo資料庫和 一個Artical表

Library檔案夾 包括用到的Castle 和 IBatisNet  Dll組件
如果引用出錯 請手動重新添加
Castle 的版本是1.1.0.0
IBatisNet 的版本為 1.6.1.0

Business.Model檔案夾 業務實體
Business檔案夾 商務邏輯
Dao檔案夾 IBatisNet Dao項目
Web檔案夾 Web2.0項目
=================================================================

由於沒有去官網去看更新文檔,就拿手上早期的版本了

接下來詳細講解

                                                                                                                               To be Continued
 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.