Is there a best practice how to prevent showing autoincrement primary-key's (ID's) from database in the ViewModel, to not make them visible for end-user?
I know there can be other unique fields on the table, which could be used. However, what if it's not sure if there is (or will stay) a unique one?
I was thinking to create a hash and save it in a column named like ViewKey in the Database. For example in the table address.
Best practice is that you need keys that are visible to users and that are meaningful and usable in the business domain (normally called business keys or natural keys). If you don't implement such keys and make them visible to users then how can you expect users to identify information in the database and use it correctly in the real world?
It doesn't make much difference whether keys are primary or not. What matters is that they are non-nullable and enforced with uniqueness constraints in your database.
If you haven't identified suitable keys already as part of your analysis and design then put in the time to do so. Business requirements must be the determining factor. There is obviously no single one-size-fits-all solution.