I have a very basic testbed Lightswitch 2013 application, using an OData data source via Web API 2 and beyond that Entity Framework 6. The table in question has an auto-incrementing id field which is the primary key.
All is good in the sense that I can view data and update existing entries via the Lightswitch HTML Client. I can't create a new entry though, and I'm not sure how to handle this 'id' field. Basically as I understand it, it must be there in the Lightswitch table because it's obviously needed to update existing entries. For new entries I don't want to supply it because the database backend will just pick the next number. I have verified via Fiddler that I can create a new entry via OData and a POST without supplying a value for 'id', so how do I make Lightswitch ignore it ?
When you create Lightswitch entites, Lightswitch creates the id column in your table and sets it to auto increment therefore SQL is handling it, not the Lightswitch framework. Therefore if your POST via OData does the job then in my mind it should be ok.