Linq to Entities: Next Value in Sequence
I'm working on a LINQ to Entities project for school. I am working with a db2 database that generates key values through a generated sequence eg. INSERT INTO STUDENT VALUES(NEXT VALUE FOR STUDENT_NUM, 'Raphael', 'Joasia开发者_JS百科');
Is the there an equivalent to the NEXT VALUE
operator in LINQ to Entities that will do the same or will I need to change how my database operates in regards to generating keys? I do use this sequence for generating values on several foreign key tables. If there is a way to do this it would be a huge help.
Unless you can generate the key itself you will need to use a stored procedure like you said. The first release of Entity Framework doesn't handle edge case scenarios very well, even if this doesn't seem like much of an edge case...
A related question was asked here. ADO.NET Entity Framework and identity columns Short answer is entity framework plays well with int keys but not GUID keys. Details are in the answers to the previously asked question. Also there will not be an ID parameter for creating the new object.
精彩评论