本文介绍了从NHibernate映射生成数据库模式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以从Nhibernate映射DLL生成数据库模式?

Is it possible to generate the database schema from the Nhibernate mappings DLL?

我的要求是MySQL。
如果是这样,我该怎么做?有工具/脚本吗?开源/免费工具?

此外,我可以使用这些工具将数据集插入/更新到数据库吗?

My requirements is for MySQL.If so, how do I do that? Are there tools/scripts for this? Open source/freeware tools?
Additionally, can I use these tools to insert/update datasets to the database?

推荐答案

您尝试使用?

var cfg = new NHibernate.Cfg.Configuration();
cfg.Configure();
cfg.AddAssembly(typeof(AnEntityInYourMappingLib).Assembly);
new NHibernate.Tool.hbm2ddl.SchemaExport(cfg).Execute(false, true, false, false);

这篇关于从NHibernate映射生成数据库模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-04 00:30
查看更多