在VS Nuget包管理器中将Castle.ActiveRecord下载到项目中
在项目中的app.config中添加如下配置节点
<?xml version="1.0" encoding="utf-8" ?> <configuration> <configSections> <section name="activerecord" type="Castle.ActiveRecord.Framework.Config.ActiveRecordSectionHandler, Castle.ActiveRecord"/> </configSections> <activerecord isWeb="false"> <config> <add key="connection.driver_class" value="NHibernate.Driver.SqlClientDriver" /> <add key="dialect" value="NHibernate.Dialect.MsSql2008Dialect" /> <add key="connection.provider" value="NHibernate.Connection.DriverConnectionProvider" /> <add key="proxyfactory.factory_class" value="NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle" /> <add key="connection.connection_string" value="Data Source=172.30.164.181;Initial Catalog=StudentDB;User ID=sa;Password=Huyangke@313" providerName="System.Data.SqlClient" /> </config> </activerecord> </configuration>
至此Castle.ActiveRecord的环境就配置好了