Note that there are some explanatory texts on larger screens.

plurals
  1. POServer-generated keys and server-generated values are not supported by SQL Server Compact
    primarykey
    data
    text
    <p>I just started to play with the entity framework, so I decided to connect it to my existing SQL Server CE database. I have a table with an IDENTITY(1, 1) primary key but when I tried to add an entity, I've got the above-mentioned error.</p> <p>From <a href="http://technet.microsoft.com/en-us/library/cc835494.aspx" rel="noreferrer">MS Technet artice</a> I learned that</p> <blockquote> <p>SQL Server Compact does not support entities with server-generated keys or values when it is used with the Entity Framework. When using the Entity Framework, an entity’s keys may be marked as server generated. This enables the database to generate a value for the key on insertion or entity creation. Additionally, zero or more properties of an entity may be marked as server-generated values. For more information, see the Store Generated Pattern topic in the Entity Framework documentation. SQL Server Compact does not support entities with server-generated keys or values when it is used with the Entity Framework, although the Entity Framework allows you to define entity types with server-generated keys or values. Data manipulation operation on an entity that has server-generated values throws a "Not supported" exception.</p> </blockquote> <p>So now I have a few questions:</p> <ul> <li>Why would you mark key as server-generated if it is not supported and will throw an exception? It's hard to make sence from the quoted paragraph.</li> <li>When I've tried to add StoreGeneratedPattern="Identity" to my entity's property, Studio complained that it is not allowed. What I'm doing wrong?</li> <li>What is the best workaround for this limitation (including switching to another DB)? My limitations are zero-installation and using entity framework.</li> </ul>
    singulars
    1. This table or related slice is empty.
    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.
 

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