SQL Server compact does not support server-generated items and server-generated value exception type = "system. notsupportedexception"

Source: Internet
Author: User

This is the first time I used SQL Server ce to practice entitier framework. this error is reported for a simple insert operation. I checked msdn later and found it because I used the auto-increment field, in the Entity Framework, SQL Server ce does not support keys or values generated by the server.

The reason is as follows:

When used together with the Entity Framework, SQL Server compact has the following restrictions:

  • When used together with the Entity Framework, SQL Server compact does not support entities with keys or values generated by the server.
    When an Entity Framework is used, the entity key may be marked as generated by the server. In this way, the database can generate a key value when inserting or creating an object. In addition, zero or multiple attributes of an object can be marked as the value generated by the server. For more information, see the schema topic generated by storage in the Entity Framework documentation.
    When used together with the Entity Framework, SQL Server compact does not support entities with server-generated keys or values, although the Entity Framework allows you to define entity types with server-generated keys or values. An "unsupported" exception occurs when processing an object with the value generated by the server.
  • When SQL Server compact is used together with the Entity FrameworkSkipExpression. On the other hand, SQL Server compact supportsLimitAndTopExpression.
    Paging query is used to support stateless paging (scrolling or window-based) through the query results ).

Msdn article: http://msdn.microsoft.com/zh-cn/library/cc835494 (V = SQL .100). aspx

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.