tabs ↹ over ␣ ␣ ␣ spaces

by Jiří {x2} Činčura

What the hell, where's my added view?

Published 14 May 2009 in Entity Framework

This behavior may confuse you. You’re adding new shiny view and it’s not added into the model. Where’s the problem?

Well the problem is caused by the fact, that every object in EDM has (must have) key (EntityKey). And because usually you have no one on view the view is added but it’s commented out. Hence if you open your EDMX file in XML editor, you’ll see the comment and you can uncomment it. The designer is trying to infer the key from not null columns, but that’s may not be true in your case. Thus you may need to edit selected columns in [][2] ([CSDL][3]) element. Then save and you're done. You can use the view in your model.