Note that there are some explanatory texts on larger screens.

plurals
  1. POEntity Framework 4 with SQL CE 4 Problem
    primarykey
    data
    text
    <p>I created a entity framework 4.0 application by creating a model. The SQL Server Compact edition 4.0 database is created with <a href="https://stackoverflow.com/questions/5205280/entity-framework-4-and-sql-compact-4-how-to-generate-database">this trick</a>. </p> <p>Now I finished all my code for importing the initial data into my database (Adding elements works fine). But if I try to access the elements via</p> <pre><code> Context context = new Context(); foreach (var c in context.Customers) // Exception { System.Diagnostics.Debug.Print(c.ToString()); } </code></pre> <p>it throws an exception at the start of the foreach loop:</p> <pre><code>[A]System.Data.SqlServerCe.SqlCeConnection cannot be cast to [B]System.Data.SqlServerCe.SqlCeConnection. Type A originates from 'System.Data.SqlServerCe, Version=4.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' in the context 'Default' at location 'C:\Windows\assembly\GAC_MSIL\System.Data.SqlServerCe\4.0.0.0__89845dcd8080cc91\ System.Data.SqlServerCe.dll'. Type B originates from 'System.Data.SqlServerCe, Version=3.5.1.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' in the context 'Default' at location 'C:\Windows\assembly\GAC_MSIL\System.Data.SqlServerCe\ 3.5.1.0__89845dcd8080cc91\System.Data.SqlServerCe.dll'. </code></pre> <p>I added these references to my application:</p> <pre><code>System.Data.Entity - 4.0 System.Data.SqlServerCe - 4.0 System.Data.SqlServerCe.Entity - 4.0 </code></pre> <p>Does anyone has an idea, what is wrong with my configuration? </p> <p><em>PS: I want to use SQL CE 4.0 because of the computed values. If I need to use 3.5, I need to change my architecture (Or is it possible to implement something like computed values inside the context class?).</em></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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