我写了一个简单的测试程序,它会访问默认的HR模式上的Oracle Express在使用DevArt dotConnect用于Oracle V直流模式6.8.0.350:StoreGeneratedPattern不能与DevArt实体框架一起使用?
using (var ctx = new HREntities())
{
var locNew = new LOCATION();
locNew.CITY = "Magdeburg";
ctx.LOCATIONs.AddObject(locNew);
ctx.SaveChanges();
// will output 0; in database ID is generated
Console.WriteLine(locNew.LOCATIONID);
}
正如你可以看到我在做一个插入进入LOCATION
表。在这里,我增加了一个触发器:
create or replace
trigger TRG_LOCATION_INS
before insert on "HR"."LOCATIONS"
for each row
begin
if inserting then
select LOCATIONS_SEQ.nextval into :NEW."LOCATION_ID" from dual;
end if;
end;
最后一个步骤是在我的模型设定StoreGeneratedPattern
到Identity
(是的,我检查,如果它被写入到XML)。
如果我运行测试应用程序,则创建记录并获得有效的新记录LocationID
。但在EF中,新ID不会到达。
为什么不识别生成的ID?如果有,是什么意思:DevArt Blog
编辑:我在不同情况下测试开始:
- devArt EntityModel在直接模式
- devArt EntityModel与OracleClient的
- ADO.NET EntityModel与OracleClient的
结果是一样的。 SaveChanged上不返回DSID
。作为另一个结果是,如果我写
ctx.Refresh(RefreshMode.ClientWins, log);
一个InvalidOperationException将提高的说法,现在有实体键“0”,这是正确的,但没有帮助:-(。
对不起,我看到你的回答太迟了。谢谢。 – sprinter252 2012-08-19 09:49:23
这已被更正在新版本中,我beleive ..我有一个.EDML虽然和EntityFramework 6 – hanzolo 2014-02-07 00:00:52