'In LinqPad, querying Databases in LinqPad 6 and 7
In LinqPad 5 the following code example works very well for accessing information for databases which includes information such as Recovery Model, encryption status and other useful information for a DBA. This is using Linq to SQL for the SQL Server Database connection.
from d in Databases
select d
*when database connection in LINQPad points to the master database for a SQL server.
However, access to Databases does not work in LinqPad 6 or 7. I have been trying for a while to upgrade my queries that use Databases so I can run them in LinqPad 6+ without success.
Is there any setting that can be used or an alternate query to accomplish the same results in LinqPad 6 and 7?
Solution 1:[1]
If you tick Include System Tables, Views and SPs in Connection Properties > Advanced, you'll be able to access sys.Databases. Interestingly, this works for every database except master (I'll get this fixed in the next LINQPad 7 build).
Note that LINQPad 5 incorrectly exposed this property as Databases rather than sys.Databases.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Joe Albahari |
