今天夜晚花费了片只钟头从Castle网站将到最新的Castle.Facilities.IBatisNetIntegration代码,将IBatisNet版本升级至1.3.0.0,Castle
IOC版本升级至1.0.0.2。升级过程中发现几乎个问题:
1、IBatisNet的布置文件之格式采用了标准的XML的命名空间:
   原来的providers.config 文件
      <?xml version=”1.0″ encoding=”utf-8″ ?>

            <providers>
               <clear/>
                 <provider
                     ……
             </providers>
   更改为
   <?xml version=”1.0″ encoding=”utf-8″?>
          <providers xmlns=”http://ibatis.apache.org/providers”
xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance”>
            <clear/>
             <provider
                     ……
        </providers>
  原来的SqlMap.config文件

 <?xml version=”1.0″ encoding=”utf-8″?>
<sqlMapConfig
xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance”
 xsi:noNamespaceSchemaLocation=”SqlMapConfig.xsd”>
……
</sqlMapConfig>
更改为
<?xml version=”1.0″ encoding=”utf-8″?>
<sqlMapConfig xmlns=”http://ibatis.apache.org/dataMapper”
xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance”>
原来的PO.xml文件
<?xml version=”1.0″ encoding=”UTF-8″ ?>

<sqlMap namespace=”Sequence”
xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance”
 xsi:noNamespaceSchemaLocation=”SqlMap.xsd”>
……
</sqlMap>
更改为
<?xml version=”1.0″ encoding=”UTF-8″ ?>
<sqlMap namespace=”Admin” xmlns=”http://ibatis.apache.org/mapping”
xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance”>
……
</sqlMap>

2、IbatisNet
增加了一个Log4Net的零件:IBatisNet.Common.Logging.Log4Net.dll,就是采取Log4Net纪录日志的包装。Log4Net组件版本升级1.2.9.0
他的配备文件如下:
<?xml version=”1.0″ encoding=”utf-8″ ?>
<configuration>
 <!– Register a section handler for the log4net section –>
 <configSections>
  <section name=”log4net”
type=”log4net.Config.Log4NetConfigurationSectionHandler, log4net”
/>
  <sectionGroup name=”iBATIS”>
   <section name=”logging”
type=”IBatisNet.Common.Logging.ConfigurationSectionHandler,
IBatisNet.Common” />
  </sectionGroup> 
 </configSections>
 
 <!– This section contains the log4net configuration settings
–>
 <log4net>
  <!– Define some output appenders –>
  <appender name=”RollingLogFileAppender”
type=”log4net.Appender.RollingFileAppender”>
   <param name=”File” value=”log.txt” />
   <param name=”AppendToFile” value=”true” />
   <param name=”MaxSizeRollBackups” value=”2″ />
   <param name=”MaximumFileSize” value=”100KB” />
   <param name=”RollingStyle” value=”Size” />
   <param name=”StaticLogFileName” value=”true” />
   <layout type=”log4net.Layout.PatternLayout”>
    <param name=”Header” value=”[Header]\r\n” />
    <param name=”Footer” value=”[Footer]\r\n” />
    <param name=”ConversionPattern” value=”%d [%t] %-5p %c [%x] –
%m%n” />
   </layout>
  </appender>
    <appender name=”ConsoleAppender”
type=”log4net.Appender.ConsoleAppender”>
   <layout type=”log4net.Layout.PatternLayout”>
    <param name=”ConversionPattern” value=”%d [%t] %-5p %c [%x]
<%X{auth}> – %m%n” />
   </layout>
  </appender>
  
  <!– Set root logger level to ERROR and its appenders –>
  <root>
   <level value=”DEBUG” />
   <appender-ref ref=”RollingLogFileAppender” />
   <appender-ref ref=”ConsoleAppender” />
  </root>
  
  <!– Print only messages of level DEBUG or above in the packages
–>
  <logger
name=”Castle.Facilities.IBatisNetIntegration.AutomaticSessionInterceptor”>
   <level value=”DEBUG” />
  </logger>
 </log4net>
 
 <iBATIS>
  <logging>
   <!–<logFactoryAdapter
type=”IBatisNet.Common.Logging.Impl.ConsoleOutLoggerFA,
IBatisNet.Common”>
    <arg key=”showLogName” value=”true” />
    <arg key=”showDataTime” value=”true” />
    <arg key=”level” value=”ALL” />
    <arg key=”dateTimeFormat” value=”yyyy/MM/dd HH:mm:ss:SSS” />
   </logFactoryAdapter> –> 
   
   <logFactoryAdapter
type=”IBatisNet.Common.Logging.Impl.Log4NetLoggerFA,
IBatisNet.Common.Logging.Log4Net”>
    <arg key=”configType” value=”inline” />
   </logFactoryAdapter> 
  </logging>
 </iBATIS>
</configuration>
3、providers.config文件支持之数据库多了db2,Informix,PostgreSql0.7,Firebird1.7,SQLite3.看来Ibatisnet越来越强了,极力推荐大家用Ibatisnet.

相关文章

网站地图xml地图