首页 > 代码库 > 升级个人网站框架组件IBatisNet+Castle

升级个人网站框架组件IBatisNet+Castle

<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="http://www.mamicode.com/log.txt" />
   <param name="AppendToFile" value="http://www.mamicode.com/true" />
   <param name="MaxSizeRollBackups" value="http://www.mamicode.com/2" />
   <param name="MaximumFileSize" value="http://www.mamicode.com/100KB" />
   <param name="RollingStyle" value="http://www.mamicode.com/Size" />
   <param name="StaticLogFileName" value="http://www.mamicode.com/true" />
   <layout type="log4net.Layout.PatternLayout">
    <param name="Header" value="http://www.mamicode.com/[Header]/r/n" />
    <param name="Footer" value="http://www.mamicode.com/[Footer]/r/n" />
    <param name="ConversionPattern" value="http://www.mamicode.com/%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="http://www.mamicode.com/%d [%t] %-5p %c [%x] <%X{auth}> - %m%n" />
   </layout>
  </appender>
  
  <!-- Set root logger level to ERROR and its appenders -->
  <root>
   <level value="http://www.mamicode.com/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="http://www.mamicode.com/DEBUG" />
  </logger>
 </log4net>
 
 <iBATIS>
  <logging>
   <!--<logFactoryAdapter type="IBatisNet.Common.Logging.Impl.ConsoleOutLoggerFA, IBatisNet.Common">
    <arg key="showLogName" value="http://www.mamicode.com/true" />
    <arg key="showDataTime" value="http://www.mamicode.com/true" />
    <arg key="level" value="http://www.mamicode.com/ALL" />
    <arg key="dateTimeFormat" value="http://www.mamicode.com/yyyy/MM/dd HH:mm:ss:SSS" />
   </logFactoryAdapter> --> 
   
   <logFactoryAdapter type="IBatisNet.Common.Logging.Impl.Log4NetLoggerFA, IBatisNet.Common.Logging.Log4Net">
    <arg key="configType" value="http://www.mamicode.com/inline" />
   </logFactoryAdapter> 
  </logging>
 </iBATIS>
</configuration>
3、providers.config文件支持的数据库多了db2,Informix,PostgreSql0.7,Firebird1.7,SQLite3.看来Ibatisnet越来越强大了,极力推荐大家采用Ibatisnet.

升级个人网站框架组件IBatisNet+Castle