标签:
一、Access数据库配置
NHibernate本身不支持Access数据库,一开始看网上各种文档,捣敲浪费了N分钟。还是祭起Nuget神器引用NHibernate.JetDrive。代码如下,搞定收工。。。
private string FilePath { get; set; }
private ISessionFactory BuildSessionFactory()
{
var connectionString = string.Format("Provider=Microsoft.Jet.OLEDB.4.0;Data Source={0};", this.FilePath);
return Fluently.Configure()
.Database(JetDriverConfiguration.Standard
.ConnectionString(connectionString)
.Dialect<JetDialect>()
.Driver<JetDriver>())
.Mappings(p => p.FluentMappings.AddFromAssembly(Assembly.GetExecutingAssembly()))
.BuildSessionFactory();
}
标签:
原文地址:http://www.cnblogs.com/czhelp/p/5621473.html