Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

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.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8877237
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T19:25:09+00:00 2026-06-14T19:25:09+00:00

How to implement in EF5 a KeyTable style identity method Uses a table in

  • 0

How to implement in EF5 a KeyTable style identity method

“Uses a table in the database to store the next Id, and advances this value every time a new block of Ids is required” from LightSpeed

I believe this is like Oracle sequences.

This feels like it should be easy (as it is in LightSpeed). This gives the ORM an easy way to do bulk inserts ie it can get 10 identities at a time, then do a bulk insert back to the db.

Am using EF5 / WCF RIA Services (latest) talking to Silverlight. The rest of the project uses bulk insert SSIS stuff.. and the SL project does some inserting. So I need to follow this convention.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T19:25:11+00:00Added an answer on June 14, 2026 at 7:25 pm

    I guess the question is fundamentally more about whether Entity Framework can support this style of key generation, and a secondary part of the question is whether RIA Services would integrate OK with that.

    It reminds me of the range of key generation strategies that are available in NHibernate.

    Here’s an answer here which suggests that EF does not have such full support as NHibernate ‘out of the box’:

    Unfortunately, EF doesn’t have anything very close to the POID
    generators like NHibernate does, although I hear rumors that similar
    capabilities will be included in the next release of EF.

    from HiLO for the Entity Framework

    This answer suggests that it’s not too tricky to intercept a Save (specifically an insert) in RIA Services and call a SPROC to get the new ID

    you only need to call stored procedure to get a value before you are
    going to save the record [can put this into an] overriden
    SaveChanges() in your context

    see https://stackoverflow.com/a/5924487/5351 in answer to What is the best way to manually generate Primary Keys in Entity Framework 4.1 Code First

    and a similar answer here… https://stackoverflow.com/a/5277642/5351

    Here are some findings on possibly implementing a HiLo generator (a more robust key gen pattern) with EF:

    The Hi/Lo pattern describe a mechanism for generating safe-ids on the
    client side rather than the database. Safe in this context means
    without collisions. This pattern is interesting for three reasons:

    • It doesn’t break the Unit of Work pattern (check  this link and this other one)
    • It doesn’t need many round-trips as the Sequence generator in other DBMS.
    • It generates human readable identifier unlike to GUID techniques.

    from http://joseoncode.com/2011/03/23/hilo-for-entityframework/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I implement this interleave method in java but it doesn't work properly. Where is
I implement a software application that uses a SQL server database. I'm running a
Task: implement paging of database records suitable for different RDBMS. Method should work for
I have an application. This application uses an interface to access the database. This
To implement a timer, I'm currently forking a process that uses SIGALRM to periodically
Implement Biginteger Multiply use integer array to store a biginteger like 297897654 will be
To implement depth-first search in a grid, I wrote a function like this (define
I implement a reference counting schema and for this i need interlock facilities but
I should implement periodically popup form at other form. This popup form isn't common
To implement real numbers between 0 and 1, one usually uses ANSI floats or

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.