开发者

EF4 Oracle Identity Insert

Does anyone know if its possible to call an oracle's sequence.NextVal from ef4 without using StoredProcedure? I have an Oracle db 开发者_运维知识库from a client which I cannot modify, so stroedproc are not an option for me. I use ef4 ctp5.

Thank!


For example, you can execute an SQL command:

  OracleParameter param = new OracleParameter("p", OracleDbType.Integer, System.Data.ParameterDirection.Output);
  oContext.Database.SqlCommand("begin SELECT sequence_name.nextval into :p FROM dual; end;", param);
  int i = (int)param.Value;

I have tested this code using dotConnect for Oracle 6.0.86, it works.


I'm not familiar with ef4 but can you execute regular queries like this?

SELECT sequence_name.nextval
FROM dual;
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜