升级个人网站框架组件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="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] &lt;%X{auth}&gt; - %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.

posted @ 2017-05-25 21:38  张宇航  阅读(156)  评论(0编辑  收藏  举报
友情链接:回力 | 中老年女装 | 武汉英语培训机构 | SAT培训机构 | 托福培训机构