I'm new to Entity Framework. I have multiple tables that have a 'SortOrder' column. This column declares the ordering in which the rows should appear when rendered.
Whenever an insert happens through my application I would like the DBcontext to 'detect' that a sortorder column exists, and have it automatically fill/overwrite this value with the MAX(sortorder) in this specific table + 1.
What is the best way of achieving this? I have experimented with using database triggers, but apparently that does not work well with EF.
Apart from that I can only think of some nasty reflection, or coding this logic in every insert I do in the application (or at least once for every tabel).
thanks,