c# - EF6 Code First: when inserting initialize column that occures in multiple tables -


i'm new entity framework. have multiple tables have 'sortorder' column. column declares ordering in rows should appear when rendered.

whenever insert happens through application dbcontext 'detect' sortorder column exists, , have automatically fill/overwrite value max(sortorder) in specific table + 1.

what best way of achieving this? have experimented using database triggers, apparently not work ef.

apart can think of nasty reflection, or coding logic in every insert in application (or @ least once every tabel).

thanks,

try add attribute sorderorder columns

[databasegenerated(databasegeneratedoption.identity)] 

read entity framework auto incrementing field, isn't id


Comments

Popular posts from this blog

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -