明天中午花了多个时辰从Castle网址获得新型的Castle.Facilities.IBatisNetIntegration代码,将IBatisNet版本升级到一.3.0.0,Castle
IOC版本升级到一.0.0.贰。升级进程中发觉多少个难点:
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,<?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
增添了三个Log肆Net的机件:IBatisNet.Common.Logging.Log四Net.dll,正是选用Log四Net纪录日志的卷入。Log四Net组件版本升级壹.2.玖.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>
三、providers.config文件协助的数据库多了db二,Informix,PostgreSql0.7,Firebird一.柒,SQLite叁.看来Ibatisnet越来越强大了,极力推荐我们使用Ibatisnet.

相关文章

网站地图xml地图