问题描述
我们正在使用EF5与Oracle [Oracle.manageddataaccess.client]。只要创建/刷新edmx.I松开属性StoreGeneratedPattern =Identity。我必须为每个实体手动设置。
We are using EF5 with Oracle[Oracle.manageddataaccess.client].Whenever I create/refresh edmx.I loose the property StoreGeneratedPattern="Identity". I had to set this manually for each and every Entity.
有没有办法自动化或其他任何工作?我在这里缺少什么?
Is there any way to automate it or any other work around ? am I missing something here ?
我们使用VS2013,下面是创建后edmx中的示例实体。
We use VS2013,Below is the sample entity in the edmx after create.
<EntityType Name="ADDRESS">
<Key>
<PropertyRef Name="ADDRESS_ID" />
</Key>
<Property Name="ADDRESS_ID" Type="number" Precision="38" Scale="0" Nullable="false" />
<Property Name="CLIENT_ID" Type="number" Precision="38" Scale="0" Nullable="false" />
<Property Name="USER_ID" Type="number" Precision="38" Scale="0" />
<Property Name="ADDRESS_ACT_FLG" Type="number" Precision="38" Scale="0" />
<Property Name="ADDRESS_1" Type="varchar2" MaxLength="50" />
<Property Name="ADDRESS_2" Type="varchar2" MaxLength="50" />
<Property Name="ADDRESS_3" Type="varchar2" MaxLength="50" />
<Property Name="ADDRESS_4" Type="varchar2" MaxLength="50" />
<Property Name="ADDRESS_SUFFIX" Type="char" MaxLength="2" />
<Property Name="COUNTY" Type="varchar2" MaxLength="50" />
<Property Name="CITY" Type="varchar2" MaxLength="50" />
<Property Name="STATE_PROVINCE" Type="varchar2" MaxLength="75" />
<Property Name="COUNTRY" Type="varchar2" MaxLength="50" />
<Property Name="POSTAL_CODE" Type="varchar2" MaxLength="10" />
<Property Name="ADDRESS_TYPE" Type="varchar2" MaxLength="2" />
<Property Name="PRIMARY_ADDRESS_IND" Type="number" Precision="38" Scale="0" />
<Property Name="CREATED_USER_ID" Type="number" Precision="38" Scale="0" Nullable="false" />
<Property Name="CREATED_DATE" Type="timestamp" Precision="6" Nullable="false" />
<Property Name="MODIFIED_USER_ID" Type="number" Precision="38" Scale="0" Nullable="false" />
<Property Name="MODIFIED_DATE" Type="timestamp" Precision="6" Nullable="false" />
</EntityType>
推荐答案
我写了一篇简短的博文: a href =http://blog.aitgmbh.de/2014/06/02/patch-for-entity-framework-models-based-on-oracle-databases/ =nofollow> http:// blog .aitgmbh.de / 2014/06/02 / patch-for-entity-framework-models-based-on-oracle-databases /
I have written a short blog post about it: http://blog.aitgmbh.de/2014/06/02/patch-for-entity-framework-models-based-on-oracle-databases/
也指的是我创建的NuGet包:
There I also refer to a NuGet package that I have created: http://bit.ly/1hbxIsO
这将添加自动操作edmx文件的MSBuild脚本。
This adds MSBuild scripts that manipulate the edmx file automatically.
它基本上可以让您定义哪些列应该是标识列,并确保每个构建,这些标识列的StoreGeneratedPattern属性设置为身份。
It basically lets you define which columns should be identity columns and ensures at every build that the StoreGeneratedPattern property of these identity columns is set to "Identity".
更新:补丁现在也可以在。
Update: The patch is now also available on GitHub.
这篇关于EF5与oracle edmx StoreGeneratedPattern =“身份”问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!