I'm building a Web App that has to interact with a database that has multiple tables without PK.
The database is designed intentionally like this and the schema sadly can't be modified.
I tried using Entity Framework but it has a lot of issues with this kind of tables. There seems to be a few ways to trick this, (lie to EF about the primary key i.e.), but it might introduce annoying bugs in the future.
After a quick research on NHibernate, it apparently has similar issues to EF.
I will be trying my luck with Dapper now, but perhaps any of you guys have an alternative or definitive solution for a project like this.
Thanks in advance.
You don't need a primary key. Just pick any unique index, and configure the ORM to use that index's columns as the key.
If there really are no unique indexes, then what are you planning to do with the data?
If there is really no subset of the tables columns that you can assume uniquely identify a row, then you'll never be able to update individual rows. You can pretend that it has some key, and only query it.