成人免费xxxxx在线视频软件_久久精品久久久_亚洲国产精品久久久_天天色天天色_亚洲人成一区_欧美一级欧美三级在线观看

iBATIS.NET多數據庫支持淺析

開發 后端
iBATIS.NET多數據庫支持淺析向你介紹iBATIS.NET的特性,iBATIS.NET多數據庫支持是編程人員的福音。

談到iBATIS.NET多數據庫支持我們首先來看看它本身的幫助文檔,在iBATIS.NET的幫助文檔中有介紹多數據庫支持,但是沒有寫全代碼,后來查看其源碼,并結合幫助文檔,找到了解決方法,其實道理就是另行實現一個Mapper.

iBATIS.NET多數據庫支持實例如AnthorMapper:

  1. Apache Notice#region Apache Notice      
  2.  
  3. #endregion      
  4.      
  5. using IBatisNet.Common.Utilities;      
  6. using IBatisNet.DataMapper;      
  7. using IBatisNet.DataMapper.Configuration;      
  8.      
  9. namespace IBatisNet.DataMapper      
  10. {      
  11.     /**//// ﹤summary﹥     
  12.     /// A singleton class to access the default SqlMapper defined by the SqlMap.Config      
  13.     /// ﹤/summary﹥     
  14.     public sealed class AnthorMapper      
  15.     {     
  16.         Fields#region Fields      
  17.         private static volatile ISqlMapper _mapper = null;     
  18.         #endregion      
  19.      
  20.         /**//// ﹤summary﹥     
  21.         ///       
  22.         /// ﹤/summary﹥     
  23.         /// ﹤param name="obj">﹤/param﹥     
  24.         public static void Configure (object obj)      
  25.         {      
  26.             _mapper = null;      
  27.         }      
  28.      
  29.         /**//// ﹤summary﹥     
  30.         /// Init the 'default' SqlMapper defined by the SqlMap.Config file.      
  31.         /// ﹤/summary﹥     
  32.         public static void InitMapper()      
  33.         {      
  34.             ConfigureHandler handler = new ConfigureHandler (Configure);      
  35.             DomSqlMapBuilder builder = new DomSqlMapBuilder();      
  36.             _mapper = builder.ConfigureAndWatch ("AnthorMap.config",handler);      }      
  37.      
  38.         /**//// ﹤summary﹥     
  39.         /// Get the instance of the SqlMapper defined by the SqlMap.Config file.      
  40.         /// ﹤/summary﹥     
  41.         /// ﹤returns>A SqlMapper initalized via the SqlMap.Config file.﹤/returns﹥     
  42.         public static ISqlMapper Instance()      
  43.         {      
  44.             if (_mapper == null)      
  45.             {      
  46.                 lock (typeof (SqlMapper))      
  47.                 {      
  48.                     if (_mapper == null// double-check      
  49.                     {         
  50.                         InitMapper();      
  51.                     }      
  52.                 }      
  53.             }      
  54.             return _mapper;      
  55.         }      
  56.               
  57.         /**//// ﹤summary﹥     
  58.         /// Get the instance of the SqlMapper defined by the SqlMap.Config file. (Convenience form of Instance method.)      
  59.         /// ﹤/summary﹥     
  60.         /// ﹤returns>A SqlMapper initalized via the SqlMap.Config file.﹤/returns﹥     
  61.         public static ISqlMapper Get()      
  62.         {      
  63.             return Instance();      
  64.         }  
  65.     }  
  66. }  

以上代碼只是修改了iBATIS.NET中的Mapper的代碼,將_mapper = builder.ConfigureAndWatch (handler);修改為_mapper = builder.ConfigureAndWatch ("AnthorMap.config",handler),就是根據另一個AnthorMap.config文件來生成SqlMapper。

AnthorMap.config和默認的SqlMap.config一樣,只是根據你的數據不同設置不同而已,測試AnthorMap.config如下如下:

  1. ﹤?xml version="1.0" encoding="utf-8"?﹥    
  2. ﹤sqlMapConfig       
  3.   xmlns="http://ibatis.apache.org/dataMapper"       
  4.   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"﹥    
  5.      
  6.   ﹤settings﹥    
  7.         ﹤setting useStatementNamespaces="true"/﹥    
  8.     ﹤/settings﹥    
  9.      
  10.   ﹤providers resource="ServerConfig/providers.config"/﹥    
  11.      
  12.   ﹤!-- Database connection information --﹥    
  13.   ﹤database﹥    
  14.     ﹤provider name="sqlServer2.0"/﹥    
  15.     ﹤dataSource name="CrmSystem" connectionString="server=.;database=TestDB;uid=sa;pwd="/﹥    
  16.   ﹤/database﹥    
  17.      
  18.     ﹤sqlMaps﹥    
  19.     ﹤sqlMap embedded="Test.Domain.Weather.xml,Test.Domain" /﹥    
  20.           
  21.      
  22.   ﹤/sqlMaps﹥    
  23.           
  24. ﹤/sqlMapConfig﹥ 

iBATIS.NET多數據庫支持之使用AntherMapper來創建ISqlMapper了。如下:

  1. public IList﹤Weather﹥GetWeather()      
  2. {      
  3.      ISqlMapper map = AnthorMapper.Instance();      
  4.      
  5.      return map.QueryForList﹤Weather>("Weather.Select"null);      
  6. }  

那么iBATIS.NET多數據庫支持就介紹到這里,希望這樣的介紹對你有幫助。

【編輯推薦】

  1. 動態Mapped Statement在iBATIS中應用
  2. iBATIS中添加DAO的配置淺析
  3. iBATIS DAO framework初體驗
  4. iBATIS教程之快速入門淺析
  5. iBATIS教程之like語句的寫法淺析
責任編輯:仲衡 來源: CSDN博客
相關推薦

2009-07-20 09:51:19

iBATIS.net數據庫緩存

2009-07-20 15:14:44

iBATIS.NET連

2009-07-22 09:07:01

iBATIS.NET

2009-07-20 13:22:47

iBATIS.Net日

2009-07-20 10:06:07

iBATIS.net查詢方式

2009-07-20 14:56:18

iBATIS.NET動態選擇DAO

2009-07-21 13:50:00

iBATIS.NET調

2009-07-20 13:47:08

iBATIS.NET字

2009-07-21 16:30:15

iBATIS.NET與單元測試

2009-07-16 13:50:31

ibatisResultMap

2009-07-22 14:28:52

iBATIS.NET配

2009-07-21 17:06:35

iBATIS.NET執

2009-07-20 09:27:42

IBATIS.netDAO

2009-07-22 14:11:09

配置ibatis.neiBatis.net配

2009-07-20 15:27:22

Castle.DynaiBATIS.NET

2009-07-21 14:15:00

iBATIS.NET多

2011-03-15 13:30:27

IBatis.netMySQL

2009-07-17 17:57:20

NPetShop iBATIS.Net

2009-07-28 17:36:21

ASP.NET數據庫連

2009-07-31 09:57:47

ASP.NET數據庫緩
點贊
收藏

51CTO技術棧公眾號

主站蜘蛛池模板: 99re在线免费视频 | www.4567 | 中文字幕精品一区二区三区精品 | 久久y| 国产成人精品午夜视频免费 | av在线一区二区三区 | 国产视频一区二区 | 国产一区二区三区视频 | 亚洲国产精品久久 | 欧美日韩成人在线 | 国产91在线 | 亚洲 | 亚洲综合色视频在线观看 | 日韩不卡三区 | 蜜桃久久| 国产欧美日韩一区 | 日本精品网站 | 国产成人综合亚洲欧美94在线 | www精品美女久久久tv | 亚洲一区亚洲二区 | 九九热免费视频在线观看 | 欧美精品在线播放 | 久久艹av| 久热电影 | 免费超碰 | 国产盗摄视频 | 欧美综合精品 | 一区二区三区高清在线观看 | 在线观看av免费 | 亚洲国产精品一区 | 一区二区三区亚洲 | 久久久久国产一区二区三区不卡 | 黄片毛片在线观看 | 久久黄色网| 国产真实精品久久二三区 | 亚洲精品久久久一区二区三区 | 国产精品久久国产精品久久 | 国产毛片久久久 | 欧美不卡一区二区三区 | 久久精品综合 | 精品亚洲一区二区三区 | 成人黄视频在线观看 |