Most people seem to have the opposite problem, but the solution is "grant access on the DB." I want to restrict access for one of two connections to the database (LocalDB). I'm afraid the answer is "create a database user and use that to connect." This is for testing only and I don't want to provision a user. Is there any way to enforce a readonly connection with LocalDB, say, through a connection string? I doubt it, but I thought I'd ask. Here's my current connection string:
<add name="readonlyConnection" connectionString="Data Source=(LocalDB)\MSSQLLocalDB;Database=test;Trusted_Connection=True; MultipleActiveResultSets=True" providerName="System.Data.SqlClient" />
The implementation is much more complicated but basically uses the System.Data.Entity.DbContext
class, if that helps.