Book Image

NHibernate 2 Beginner's Guide

By : Aaron Cure
Book Image

NHibernate 2 Beginner's Guide

By: Aaron Cure

Overview of this book

<p>NHibernate is an open source object-relational mapper, or simply put, a way to retrieve data from your database into standard .NET objects. Quite often we spend hours designing the database, only to go back and re-design a mechanism to access that data and then optimize that mechanism. This book will save you time on your project, providing all the information along with concrete examples about the use and optimization of NHibernate.<br /><br />This book is an approachable, detailed introduction to the NHibernate object-relational mapper and how to integrate it with your .NET projects. If you're tired of writing stored procedures or maintaining inline SQL, this is the book for you.<br /><br />Connecting to a database to retrieve data is a major part of nearly every project, from websites to desktop applications to distributed applications. Using the techniques presented in this book, you can access data in your own database with little or no code.<br /><br />This book covers the use of NHibernate from a first glance at retrieving data and developing access layers to more advanced topics such as optimization and Security and Membership providers. It will show you how to connect to multiple databases and speed up your web applications using strong caching tools. We also discuss the use of third-party tools for code generation and other tricks to make your development smoother, quicker, and more effective.</p>
Table of Contents (19 chapters)
NHibernate 2
Credits
About the Author
About the Reviewers
Preface
Index

Appenders


There are a number of predefined appender types, from file and console appenders to telnet, database, and even e-mail. If there isn't a predefined appender that meets your needs, then you can write your own (as log4net is an extensible framework) and make it work any way that you like! I recently saw an appender that creates entries on the popular microblogging website Twitter.

Defining an appender is as simple as adding it to the configuration and telling log4net to write to it. If we wanted to log to a file, for example, we could use the Rolling File appender. I use the Rolling File appender all the time because you can configure it to rotate logs on a daily or size basis, along with numerous other options.

To define a Rolling File appender that will create a new log every day, we could use the following code:

<appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
  <file value="logfile" />
  <appendToFile value="true" />
  <rollingStyle...