c# - How to generate custom keys in EF7? -


ef7 usual stuff auto-generating auto-incrementing ids, adding [key] attribute integral key. found video describes alternative strategy generating integer keys natively supported ef.

the keys in project, however, guids. , part want them generated comb guids, don't cause trouble on insertion clustered index. set default value of newsequentialid() on sql table, want generate ids in code (which why we're using guids in first place). question 1 is: how generate comb guids on key field in ef7?

then there's particular table id field needs generated hash of 1 of fields. (this can rely on identical records in different environments having same id.) question 2 is: how implement custom guid generation on inserting records in table?

i tinkered in dbcontext's onmodelcreating() method, valuegeneratedonadd() method, can't find parameters or overloads allow me set kind of custom guid generation.


Comments

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -