views:

61

answers:

1

Hello

I heard that this issue is fixed in SQL Server Compact Edition 4.0 CTP

As recently I just stepped into SQL Server CE and Entity Framework, and VS2010 not yet supporting SQL Server CE 4.0

I think I would need a work around for this issue

Can I know how to generate an Integer type Identity Primary Key inside the constructor of the Entity Object

   public partial class Book 
 {

  public Book()
  {
   // SQL Server Compact does not support entities with server-generated keys or values when it is used 
   // with the Entity Framework. Therefore, we need to create the keys ourselves.


   Id = // Generating a Integer Identity Id here
     //similar to Guid.NewGuid();

  }
}

Your help is much appreciated.

A: 

I met same problem, I take max value of the Id column after that add one. If you are developing a desktop application you should mind problem in the following link:http://stackoverflow.com/questions/3766596/problem-when-inserting-data-into-sql-compact-by-ado-net-entity-framework

Linh