- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
使用 NHibernate 迈出第一步,我试图让它从 hbm 文件自动创建我的表。数据库后端是 SQL Server 2008 Developer Edition。
这是我在 NHibernate 教程中看到的常见示例代码:
var cfg = new Configuration();
cfg.Configure();
cfg.AddAssembly(typeof(Posting).Assembly);
new SchemaExport(cfg).Execute(false,true,false,false);
遗憾的是,这不起作用。我已将 show_sql 设置为 true,它不会打印出任何语句。查看 SQL 事件探查器,我看到我的应用程序连接到数据库,但随后什么也没做。
我可以通过将第一个参数(“脚本”)更改为 true 来解决这个问题:
new SchemaExport(cfg).Execute(true,true,false,true);
我不明白为什么。遗憾的是,SchemaExport 的参数没有真正解释(也不是 .Create 和 .Execute 之间的区别),我想找出这个参数的作用,以及为什么不需要它,即在使用 SQL Compact Edition 时(也适用于脚本是错误的)
最佳答案
SchemaExport 是 Hbm2Ddl 实用程序的一部分,它真正独立于 NHibernate 功能。它不使用仅在 NHibernate 运行时使用的“show_sql”。
要获取您创建的架构的副本,请使用 .SetOutputFile(filename)
这是我在创建新数据库时使用的方法。我在 MyDDL.sql 文件中得到一个格式化的模式,数据库是从该模式构建的:
private void BuildSchema(Configuration config)
{
new SchemaExport(config)
.SetOutputFile(_fileName + "MyDDL.sql")
.Execute(true /*script*/, true /*export to db*/,
false /*just drop*/, true /*format schema*/);
}
SchemaExport.Create 只是 Schema.Execute 的快捷方式,只需删除 false 并设置为 true。
public void Create(bool script, bool export)
{
Execute(script, export, false, true);
}
关于c# - 当 "script"为 false 时,NHibernate SchemaExport 不创建表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/817359/
class test { public static void main(String[] args){ Object o1 = new Object(); O
我以为我理解了 Python 中的这两个单例值,直到我看到有人在代码中使用 return l1 or l2,其中 l1 和 l2 都是链表对象,并且(s)他想如果不为 None 则返回 l1,否则返回
这个问题在这里已经有了答案: Why does the expression 0 >> (True == False) is False True >>> True == (False is Fals
为什么在 Python 中它是这样评估的: >>> False is False is False True 但是当用括号尝试时表现如预期: >>> (False is False) is False
我有一个名为“apple”的表,我编写了以下查询: select name, count(name), case when istasty is null then fal
python boolean 逻辑中的运算符优先级 print(False==True or False) #answer is True print(False==(False or True))#
请不要看条件,因为它们在这里是为了便于理解行为 为什么 result 等于 true ? boolean result = false && (false)?false:true; 我知道我们可以通过
乍一看,这篇文章可能看起来像是重复的,但事实并非如此。相信我,我已经查看了所有 Stack Overflow,但都无济于事。 无论如何,我从 Html.CheckBoxFor 得到了一些奇怪的行为。
这个问题在这里已经有了答案: python operator precedence of in and comparison (4 个答案) 关闭 6 年前。 我的一位前辈演示了它,我想知道这是否是
我最近参加了 Java 的入门测试,这个问题让我很困惑。完整的问题是: boolean b1 = true; boolean b2 = false; if (b2 != b1 != b2) S
为什么 {} == false 评估为 false 而 [] == false 评估为 true在 javascript 中? 最佳答案 这是根据 Abstract Equality Comparis
这个问题在这里已经有了答案: Why does (1 in [1,0] == True) evaluate to False? (1 个回答) 关闭7年前。 为什么使用括号时这些语句按预期工作: >>
我试过搜索这个,但我真的不知道如何表达它以查看是否有其他人发布了答案。 但是,我正在制作一个国际象棋游戏和一个人工智能来配合它,这是非常困难的,我的问题是当我检查两个棋子是否在同一个团队时我必须做 (
关闭。这个问题需要debugging details .它目前不接受答案。 编辑问题以包含 desired behavior, a specific problem or error, and th
为什么 为 false || null 返回与 null || 不同的结果错误? 我可以安全地依赖 return myVar || false 如果 myVar 为 null 或 false,则返回
我正在尝试遵循 NHibernate 教程,“你的第一个基于 NHibernate 的应用程序:修订 #4”在 NHibernate Forge。 但线路:new SchemaExport(cfg).
这个问题在这里已经有了答案: Empty list boolean value (3 个答案) 关闭 4 年前。 我是 Python 的新手,不理解以下行为: 为什么要声明 [] == False
以下函数循环访问对象的值。如果值为空this.hasInvalidValue设置为true ,如果不为空 this.hasInvalidValue设置为false : user: { email:
所以我正在玩 java.lang.reflect 东西并尝试制作类似 this 的东西。这是我的问题(可能是一个错误): 将字段设置为 true 的方法的代码: private static void
当我在编程时,我的 if 语句出现了意想不到的结果。 这个代码警报怎么会是真的?我在 W3S 没有找到任何可以帮助我的东西,我真的很想知道为什么这些警报是“正确的” window.alert(fals
我是一名优秀的程序员,十分优秀!