Ibatisnet Quick Start

Source: Internet
Author: User
Tags configuration settings log4net
Prepare for work 1.        Download Ibatis software package (http://ibatis.apache.org/dotnetdownloads.html). 2.        Create a test database and create a person table in the database that contains three fields: name               Type             size Per_id            long  integer      4    NOT NULL per_first_name     Nvarchar         40 not NULL per_last_name      nvarchar           40 not NULL PER_BIRTH _date    datetime         8 PER_WEIGHT_KG      float            8 PER_ height_m       float            8 3. In order to be more intuitive in the development process, we need to open the Ibatisnet log to see the details of the ibatinets operation. Ibatisnet using IBatisNet.Common.Logging.Log4Net, is the use of Log4net record journal packaging. Add the following configuration content to Web.config: < configsections >          < sectiongroup Name = "IBATIS" >               < section name = "Logging" type= "IBatisNet.Common.Logging.ConfigurationSectionHandler, Ibatisnet.common"/>           </sectiongroup >          < section Name = "Log4net" type= "log4net". Config.log4netconfigurationsectionhandler, log4net "/> </configsections > < IBATIS >           < logging >                                       < Logfactoryadapter type = "IBatisNet.Common.Logging.Impl.Log4NetLoggerFA, IBatisNet.Common.Logging.Log4Net" >                    < arg key = "Configtype" value= "inline"/>                     <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 >                            </logging >      </iBATIS >    & nbsp <!--This section contains the Log4net configuration settings-->      < log4net >  & nbsp;       <!--Define some output appenders-->      & nbsp;   < 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"/>   & nbsp;           < 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 &GT;&NBsp;                <!--Set Root Logger Level to ERROR and its appenders-->          < root >   &nbsp ;           < Level value = "DEBUG"/>                < Appender-ref ref = "Rollinglogfileappender"/> & nbsp;             < Appender-ref ref = " Consoleappender "/>          </root >                    <!--Print only messages to level DEBUG or Above in the packages-->          < logger name = " IBatisNet.DataMapper.Configuration.Cache.CacheModel ">               < Level value = "DEBUG"/>          </Logger >          < logger name = " IBatisNet.DataMapper.Configuration.Statements.PreparedStatementFactory ">                < Level value = "DEBUG"/>           </Logger >          < logger name = " IBatisNet.DataMapper.LazyLoadList ">                < Level value = "DEBUG"/>          </Logger > &NBSP;&NBSP;&N bsp;      < Logger name = "IBatisNet.DataAccess.DaoSession" >                < Level value = "DEBUG"/>           </Logger >          < logger name = " IBatisNet.DataMapper.SqlMapSession ">                < Level value = "DEBUG"/>          </Logger > &NBSP;&N bsp;       < Logger name = "IBatisNet.Common.Transaction.TransactionScope" >               < Level value = "DEBUG"/>          </Logger >           < Logger name = "IBatisNet.DataAccess.Configuration.DaoProxy" >                < Level value = "DEBUG"/>           </Logger >      </log4net >        &nbsp   Building ibatisnet Base code ibatisnet Base Code includes: 1. Ibatisnet instance configuration A typical configuration file is as follows (after the meaning of the specific configuration item is seen): <?xml version= "1.0" encoding= " utf-8"?> <

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.