Gabriel
Gabriel

Reputation: 600

edmx context loses views mapping

all.

I am using entity framework and I am trying to add three new tables to my context. The problem is, I go to "Update Model From Database", select the tables and after the new tables are added in the context, my entities which refer to views, they lose mapping!

Then, I click on the entity, then on "Mapping Details" and when I click on "Maps to" I cannot see the views anymore, only the tables.

Where did the views go? Why did they lose the mappings? What do I do to solve this issue?

Best regards.

Upvotes: 0

Views: 370

Answers (1)

Gabriel
Gabriel

Reputation: 600

I still do not know why the views vanished when I updated my data model, but now I got my solution working.

What I have realized is that even if I created a new context and added only the views, they were not added! (Still I don't know why).

What I did to solve this issue was: I copied the XML file, where I had all my views, tables, etc. Then, I updated my context, adding the tables I needed. After that I edited the new XML file, adding the views' code.

This solved my issue. It's not ideal, but it solve.

Upvotes: 0

Related Questions