Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>You could try changing the generated code. So that a DIFFERENT view was returned. But if you dont return a view I expect that EF will fail.</p> <p>The idea is that the generated class is for ALL sets in a DBContext. And indeed if the view doesnt match the context you have (hash comparison) you will get a runtime error.</p> <p>eg</p> <pre><code> /// &lt;Summary&gt; /// The constructor stores the views for the extents and also the hash values generated based on the metadata and mapping closure and views. /// &lt;/Summary&gt; public ViewsForBaseEntitySets24F9763E92A9F77E970A08557E1855C7579989F684539A5FB429069F966B9B7B() { this.EdmEntityContainerName = "Ef6Ctx3"; this.StoreEntityContainerName = "CodeFirstDatabase"; this.HashOverMappingClosure = "d7686982aa7cffcf874313838914e93f78d4d7d6d345d19261ef5edc8b4e96dd"; this.HashOverAllExtentViews = "7b8857ee3ee44d13b2479e43c54dbdfb6bc8914e222c7891afcfcd9a29b06b2f"; this.ViewCount = 2; } </code></pre> <h2>But for a given view, you could return a different string</h2> <pre><code> /// &lt;Summary&gt; /// return view for CodeFirstDatabase.pocotest /// &lt;/Summary&gt; private System.Collections.Generic.KeyValuePair&lt;string, string&gt; GetView0() { return new System.Collections.Generic.KeyValuePair&lt;string, string&gt;("CodeFirstDatabase.pocotest", @" SELECT VALUE -- Constructing pocotest [CodeFirstDatabaseSchema.pocotest](T1.pocotest_Id, T1.pocotest_f1, T1.pocotest_f2, T1.pocotest_f2a, T1.pocotest_f3, T1.pocotest_f5, T1.pocotest_f6b) FROM ( SELECT T.Id AS pocotest_Id, T.f1 AS pocotest_f1, T.f2 AS pocotest_f2, T.f2a AS pocotest_f2a, T.f3 AS pocotest_f3, T.f5 AS pocotest_f5, T.f6b AS pocotest_f6b, True AS _from0 FROM Ef6Ctx3.poco1s AS T ) AS T1"); } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload