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)]
Comments
Post a Comment