【发布时间】:2011-01-07 18:41:29
【问题描述】:
我正在使用 c# .net 4.0 并使用 NHibernate 与 Oracle DB 对话。 你会认为像这样简单的事情已经在某个地方解决了,但遗憾的是它没有。 我需要 Oracle 序列中的 NextVal。 我不需要将它作为 Id 或主键的一部分插入数据库。 我只需要在 c# 端使用下一个 val。
谁能帮我解决一下 xml 映射和 C# 文件(或链接)的问题。
谢谢。
类似
int NextValueOfSequence = GetNextValueofSequence();
public int GetNextValueOfSequence()
{
// Access NHibernate to return the next value of the sequence.
}
【问题讨论】:
-
你不能在 Id 属性上运行一个最大值然后加 1 吗?
-
没有。假设数据库没有表,没有 SP,除了一个 oracle 序列什么都没有。我需要获取 nextval 并在 c# 端使用它。
标签: oracle nhibernate sequence nextval