When using SqlCommand to call a stored proc via RPC, it looks like it is possible to call a stored proc in a database other than the current database.
e.g. :
string storedProcName = "SomeOtherDatabase.dbo.SomeStoredProc";
SqlCommand cmd = new SqlCommand(storedProcName);
cmd.CommandType = CommandType.StoredProcedure;
I'd like to make my DAL code more restrictive, by disallowing potential calls to another database. One way might be to check if there are two periods (dots) in storedProcName above, and if so, throw an exception. Any other ideas/approaches ?
Thanks.