tabs ↹ over ␣ ␣ ␣ spaces

by Jiří {x2} Činčura

What the hell, where’s my added view?

14 May 2009 1 mins 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 (CSDL) element. Then save and you’re done. You can use the view in your model.

Profile Picture Jiří Činčura is .NET, C# and Firebird expert. He focuses on data and business layers, language constructs, parallelism, databases and performance. For almost two decades he contributes to open-source, i.e. FirebirdClient. He works as a senior software engineer for Microsoft. Frequent speaker and blogger at www.tabsoverspaces.com.