Fluent config不生成映射文件
我正在尝试让 Fluent nHibernate 生成映射,以便我可以查看文件和 sql。
我的代码基于这篇文章以及我可以从文档中收集到的内容。
我正在使用来自 git 的最新代码。
这是我的配置代码:
Configuration cfg = new Configuration();
var ft = Fluently.Configure(cfg);
//DbConnection by fluent
ft.Database
(
MsSqlConfiguration
.MsSql2008
.ConnectionString("……")
.ShowSql()
.UseReflectionOptimizer()
);
//get mapping files.
ft.Mappings(m =>
{
//set up the mapping locations
m.FluentMappings.AddFromAssemblyOf<Entity>()
.ExportTo(@"C:\temp");
m.Apply(cfg);
});
我也尝试过:
var sessionFactory = Fluently.Configure()
.Database(MsSqlConfiguration
.MsSql2008
.ShowSql()
.ConnectionString(“……"))
.Mappings(p => p.FluentMappings
.AddFromAssemblyOf<Entity>()
.ExportTo(@"c:\temp\"))
.BuildSessionFactory();
我已经验证连接字符串是正确的。
问题是 ExportTo 文件夹中没有显示任何映射文件,并且输出窗口或日志文件中没有显示 sql 代码。也不会生成任何错误或异常。
我不知道从这里该去哪里。
先感谢您。
瑞克
I am trying to get Fluent nHibernate to generate mappings so I can take a look at the files and the sql.
My code is based on this post and on what I can glean from the documentation.
Fluent mapping - entities and classmaps in different assemblies
I am using the latest code from git.
Here’s my config code:
Configuration cfg = new Configuration();
var ft = Fluently.Configure(cfg);
//DbConnection by fluent
ft.Database
(
MsSqlConfiguration
.MsSql2008
.ConnectionString("……")
.ShowSql()
.UseReflectionOptimizer()
);
//get mapping files.
ft.Mappings(m =>
{
//set up the mapping locations
m.FluentMappings.AddFromAssemblyOf<Entity>()
.ExportTo(@"C:\temp");
m.Apply(cfg);
});
I also tried:
var sessionFactory = Fluently.Configure()
.Database(MsSqlConfiguration
.MsSql2008
.ShowSql()
.ConnectionString(“……"))
.Mappings(p => p.FluentMappings
.AddFromAssemblyOf<Entity>()
.ExportTo(@"c:\temp\"))
.BuildSessionFactory();
I have verified that the connection string is correct.
The issue is that no mapping files show up in the ExportTo folder and no sql code shows up in the output window or in the log file. No errors or exceptions are generated either.
I have no idea where to go from here.
Thank you in advance.
Rick
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为你必须实际旋转一些对象才能写出地图。如果我没记错的话,这不是在配置时完成的。
I think you have to actually spin up some objects to get the maps written out. If I remember correctly, this is not done at config time.