开发者

When updating Entity Framework model from database, updatable views get deleted

开发者 https://www.devze.com 2023-01-31 07:40 出处:网络
I have a emdx file wit开发者_JS百科h update-able views. I made these views by following an example here where I delete the name and the type and leave just dbo:schema, however, every time I pick \"Upd

I have a emdx file wit开发者_JS百科h update-able views. I made these views by following an example here where I delete the name and the type and leave just dbo:schema, however, every time I pick "Update Model from Database" these views and the entire definition including associations and such, get removed from the file.

To solve this problem, I end up doing a manual merge with the previous version, however, this is a really long and painful process.

Anyone know what I'm doing wrong?

Example of my declared update-able view:

<EntitySet Name="vw_MeterEmisHist" EntityType="Model.Store.vw_MeterEmisHist" Schema="dbo" />


I have had the same this happen when adding node to allow for mapping stored procedures to entities. The reason for this is that the XML formatted EDMX file is always completely auto generated when the model is updated (or created) from the database.

The easiest work around that I have found is to keep a text file within my solution with the changes that I have made so that they can be easily replaced. To speed things up, its possible to create a find/replace macro within Visual Studio to automate the process.

If anyone ever gets really bored, that sort of functionality would make a great add-in. (Or a great fix in VS. MS, are you listening?)

0

精彩评论

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

关注公众号