This content has been marked as final. Show 3 replies
I solved this by selecting the next value from the sequence, and then setting the ID to that. You could do the same thing from within Lightswitch, and it'd keep the sequence in sync by using it. The downside is the extra step involved.
It should be possible to set the Entity Model up so that it knows the Id field is being set by the server and thus doesn't send it. Unfortunately I'm in the middle of getting a new laptop right now and can't tell you exactly what property in the model does that.
Great idea on using the sequence. I hadn't thought about trying to access the database outside of the Entity Model. I'll definitely give it a try.
Ideally though I would love to just edit the insert query and remove the field that gets automatically set. If you ever do find out how to do that, let me know.
Thanks so much!
I addressed something similar (though not with lightswitch) in this magazine article:
Search on "Triggers and Sequences"
There's some example code so you can try it out.