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

iBATIS.NET多數(shù)據(jù)庫支持淺析

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

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

iBATIS.NET多數(shù)據(jù)庫支持實(shí)例如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),就是根據(jù)另一個(gè)AnthorMap.config文件來生成SqlMapper。

AnthorMap.config和默認(rèn)的SqlMap.config一樣,只是根據(jù)你的數(shù)據(jù)不同設(shè)置不同而已,測試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多數(shù)據(jù)庫支持之使用AntherMapper來創(chuàng)建ISqlMapper了。如下:

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

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

【編輯推薦】

  1. 動(dòng)態(tài)Mapped Statement在iBATIS中應(yīng)用
  2. iBATIS中添加DAO的配置淺析
  3. iBATIS DAO framework初體驗(yàn)
  4. iBATIS教程之快速入門淺析
  5. iBATIS教程之like語句的寫法淺析
責(zé)任編輯:仲衡 來源: CSDN博客
相關(guān)推薦

2009-07-20 09:51:19

iBATIS.net數(shù)據(jù)庫緩存

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-21 13:50:00

iBATIS.NET調(diào)

2009-07-20 14:56:18

iBATIS.NET動(dòng)態(tài)選擇DAO

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執(zhí)

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數(shù)據(jù)庫連

2009-07-31 09:57:47

ASP.NET數(shù)據(jù)庫緩
點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號

主站蜘蛛池模板: 亚州精品天堂中文字幕 | 精品久久精品 | 亚洲欧美一区二区三区视频 | 亚洲高清电影 | 黑人粗黑大躁护士 | 日韩欧美专区 | 欧美久久精品一级黑人c片 91免费在线视频 | 一区二区亚洲 | 成人国产精品久久久 | 一区二区三区四区视频 | 成年人视频在线免费观看 | 国产一区二区精品在线 | 97国产精品 | www.av7788.com| 久久久久久国产精品免费 | 久久99视频这里只有精品 | 欧美一区二区 | 国产成人精品网站 | 伊人网在线看 | 欧美日韩亚洲国产 | 久久人人国产 | 日韩精品国产精品 | 欧美日韩免费一区二区三区 | 国产日韩欧美一区二区 | 久久亚洲一区二区三区四区 | 91看片网站| 中文字幕av亚洲精品一部二部 | 久久精品久久久久久 | 亚洲激情一区二区 | a级片在线观看 | 欧美日韩一区二区在线 | 免费成人高清在线视频 | 麻豆久久| 91国在线观看 | 亚洲一区中文字幕在线观看 | 涩涩视频在线观看 | 日韩最新网址 | 国产精品成人一区 | 在线观看日韩av | 成人福利网站 | 日韩精品视频在线 |