I want to have unique object ids over whole database. Is there any built-in feature in EF?
Or may be there are some practices/patterns?
thanks in advance.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
1) Create table to store last id (int, bigint) (identifier domain)
2) Add stored procedure to retrieve the next id (int, bigint).
3) You may implement Custom Data Class EntityObject and ComplexObject (or maybe assign to every entity manualy in code)
4) Use this id in your custom class as primary key
—
If you using GUID…EF(4) has build-in feature to do this. But GUID as primary key with CLUSTERED INDEX is bad solution for the many insertion of course.