Identity Keys - Making my own

Posts   
 
    
ianvink
User
Posts: 393
Joined: 15-Dec-2006
# Posted on: 21-Sep-2007 21:07:24   

Our system runs on multiple data centers in different countries. We need to roll up values from tables into a warehouse. So we need a unique key for each record, ints of course not being an option.

Guids are too slow. (see: http://www.informit.com/articles/article.aspx?p=25862&rl=1 )

So we have a function that will return a unique key that doesn't have the same performace penalty (see same article for the generator).

Is there a way with version 2.5, SelfServicing, to tell the system to use this function as it's unique key generator instead of relying on @@Identy etc?

I can override every entity collections' EntityAdding function, but would rather have a way to specify it, perhaps with Dependency injection?

Thanks, Ian

JimHugh
User
Posts: 191
Joined: 16-Nov-2005
# Posted on: 21-Sep-2007 21:32:32   

If there is any chance you can use SQL 2005 instead of 2000, you may want to look at NEWSEQUENTIALID(). Still a GUID, but eliminates some of the concerns in the referenced article.

Do a Google search to see some of the pros and cons.

Walaa avatar
Walaa
Support Team
Posts: 14950
Joined: 21-Aug-2005
# Posted on: 24-Sep-2007 10:39:05   

Maybe you just need to use a common base Validator to validate the entity before save, to call your method and set the Unique field.