">
NHibernate
不仅仅管理.NET类到数据库表的映射(包括.NET 数据类型到SQL数据类型的映射),还提供数据查询和获取数据的方法,可以大幅度减少开发时人工使用SQL和ADO.NET处理数据的时间。var cfg = new Configuration();
cfg.SetProperty("connection.provider", "NHibernate.Connection.DriverConnectionProvider");
cfg.SetProperty("connection.driver_class", "NHibernate.Driver.SQLite20Driver");
cfg.SetProperty("dialect", "NHibernate.Dialect.SQLiteDialect");
cfg.SetProperty("connection.connection_string", "Data Source=:memory:;Version=3;New=True;");
cfg.SetProperty("connection.release_mode", "on_close");
cfg.SetProperty("show_sql", "true");
cfg.AddAssembly(typeof (Blog).Assembly);
ISessionFactory factory = cfg.BuildSessionFactory();
<section name="hibernate-configuration"
type="NHibernate.Cfg.ConfigurationSectionHandler, NHibernate" />
</configSections>
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
<session-factory>
<property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>
<property name="connection.driver_class">NHibernate.Driver.SqlClientDriver</property>
<property name="connection.connection_string">Server=(local);database=thedatabase;Integrated Security=SSPI;</property>
<property name="dialect">NHibernate.Dialect.MsSql2005Dialect</property>
<property name="show_sql">true</property>
</session-factory>
</hibernate-configuration>