Holmes 5.0.52

There is a newer version of this package available.
See the version list below for details.
dotnet add package Holmes --version 5.0.52
                    
NuGet\Install-Package Holmes -Version 5.0.52
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Holmes" Version="5.0.52" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Holmes" Version="5.0.52" />
                    
Directory.Packages.props
<PackageReference Include="Holmes" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Holmes --version 5.0.52
                    
#r "nuget: Holmes, 5.0.52"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Holmes@5.0.52
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Holmes&version=5.0.52
                    
Install as a Cake Addin
#tool nuget:?package=Holmes&version=5.0.52
                    
Install as a Cake Tool

Holmes

Build status

Holmes is a database analysis library. It scans a database and returns suggestions for improvement. Supports .Net Core as well as full .Net

Setting Up the Library

In order to use Holmes, you need to start by wiring it up on your ServiceCollection. However this takes just one extension method call:

serviceCollection.AddCanisterModules();
				

When this is done, Holmes is ready to use.

Basic Usage

The main class of interest is the Sherlock class:

var Results = Sherlock.Analyze(new Connection(...));

The Sherlock class contains one function which is Analyze. This function takes a Connection object defining where the library should be pointed. It will then, based on the provider specified in the connection object, run any analysis classes that it has and returns a list of Finding objects. The Finding class looks like this:

public class Finding
{
	public string Fix { get; }
	public IDictionary<string, object> Metrics { get; }
	public string Text { get; }
}

The Text property contains the explination of what was found, the Metrics property contains the data that was returned by the analysis object, and the Fix property contains the SQL command that can be used to remedy the issue. Note that not all analysis classes will contain a suggested fix. This is optional where as the other two properties will always contain some information.

Adding Your Own Analyzer

The system a couple of built in analyzers:

  • SQL Server
    • Recent expensive queries
    • Missing indexes
    • Overlapping indexes
    • Unused indexes

However you can easily add your own analyzer by simply creating a class that inherits from IAnalyzer. The system will then pick it up automatically and run it as well. For simple analyzers there is also an AnalyzerBaseClass that will simplify the process of setting up your analyzer. The IAnalyzer interface itself is rather simple though:

public interface IAnalyzer
{
    /// <summary>
    /// Gets the factory the analyzer supports.
    /// </summary>
    /// <value>Gets the factory the analyzer supports.</value>
    DbProviderFactory SupportedFactory { get; }

    /// <summary>
    /// Adds the query the analyzer needs to the batch.
    /// </summary>
    /// <param name="batch">The batch.</param>
    /// <returns>This.</returns>
    IAnalyzer AddQuery(SQLHelper.SQLHelper batch);

    /// <summary>
    /// Analyzes the specified connection's source database.
    /// </summary>
    /// <param name="results">The results of the analysis.</param>
    /// <returns>The list of suggestions for the database.</returns>
    IEnumerable<Finding> Analyze(IEnumerable<dynamic> results);
}

The SupportedFactory property is the DbProviderFactory that this analyzer should be run against. All analyzer queries are batched together by the system and run at once. As such there is an AddQuery function. With this function the system passes you the SQLHelper object it is using to batch the various queries. The one method on that you will probably use is AddQuery. The only other method is Analyze. This method recieves the results of the query as a list of dynamic objects. The names of each property is the same as the result set of the query you specified previously. In turn you should return a list of Finding objects.

Installation

The library is available via Nuget with the package name "Holmes". To install it run the following command in the Package Manager Console:

Install-Package Holmes

Build Process

In order to build the library you will require the following:

  1. Visual Studio 2022

Other than that, just clone the project and you should be able to load the solution and build without too much effort.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Holmes:

Package Downloads
Inflatable

Inflatable is a simple ORM.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
5.0.63 167 8/6/2025
5.0.62 167 8/5/2025
5.0.61 167 8/5/2025
5.0.60 168 8/5/2025
5.0.59 171 8/5/2025
5.0.58 169 8/5/2025
5.0.57 17 8/1/2025
5.0.56 92 7/29/2025
5.0.55 91 7/29/2025
5.0.54 124 7/17/2025
5.0.53 128 7/16/2025
5.0.52 159 7/15/2025
5.0.51 136 7/15/2025
5.0.50 130 7/15/2025
5.0.49 158 7/8/2025
5.0.48 257 7/1/2025
5.0.47 134 7/1/2025
5.0.46 137 7/1/2025
5.0.45 144 6/28/2025
5.0.44 67 6/27/2025
5.0.43 182 6/27/2025
5.0.42 179 6/26/2025
5.0.41 146 6/18/2025
5.0.40 287 6/10/2025
5.0.39 79 5/30/2025
5.0.38 89 5/23/2025
5.0.37 233 5/14/2025
5.0.36 86 5/2/2025
5.0.35 172 4/29/2025
5.0.34 196 4/10/2025
5.0.33 171 3/17/2025
5.0.32 129 2/24/2025
5.0.31 153 2/13/2025
5.0.30 262 2/3/2025
5.0.29 167 1/30/2025
5.0.28 127 1/29/2025
5.0.27 136 1/29/2025
5.0.26 147 1/28/2025
5.0.25 138 1/24/2025
5.0.24 133 1/23/2025
5.0.23 141 1/22/2025
5.0.22 141 1/16/2025
5.0.21 130 1/15/2025
5.0.20 79 1/14/2025
5.0.19 95 1/13/2025
5.0.18 113 1/10/2025
5.0.17 97 1/9/2025
5.0.16 78 1/8/2025
5.0.15 202 12/17/2024
5.0.14 150 12/16/2024
5.0.13 155 12/10/2024
5.0.12 139 12/9/2024
5.0.11 146 12/6/2024
5.0.10 192 11/27/2024
5.0.9 129 11/26/2024
5.0.8 162 11/26/2024
5.0.7 159 11/24/2024
5.0.6 128 11/24/2024
5.0.5 122 11/23/2024
5.0.4 124 11/23/2024
4.0.270 145 11/19/2024
4.0.269 136 11/11/2024
4.0.268 121 11/7/2024
4.0.267 125 11/5/2024
4.0.266 119 11/4/2024
4.0.265 135 11/1/2024
4.0.264 121 11/1/2024
4.0.263 124 10/30/2024
4.0.262 132 10/29/2024
4.0.261 126 10/29/2024
4.0.260 131 10/26/2024
4.0.259 135 10/24/2024
4.0.258 138 10/21/2024
4.0.257 142 10/17/2024
4.0.256 133 10/15/2024
4.0.255 133 10/11/2024
4.0.254 130 10/10/2024
4.0.253 125 10/9/2024
4.0.252 137 10/9/2024
4.0.251 176 10/3/2024
4.0.250 148 10/2/2024
4.0.249 150 9/30/2024
4.0.248 141 9/28/2024
4.0.247 129 9/24/2024
4.0.246 134 9/23/2024
4.0.245 130 9/23/2024
4.0.244 175 9/17/2024
4.0.243 156 9/16/2024
4.0.242 151 9/10/2024
4.0.241 138 9/9/2024
4.0.240 140 9/6/2024
4.0.239 136 9/6/2024
4.0.238 147 9/3/2024
4.0.237 152 9/2/2024
4.0.236 139 8/30/2024
4.0.235 144 8/30/2024
4.0.234 148 8/28/2024
4.0.233 155 8/27/2024
4.0.232 142 8/26/2024
4.0.231 172 8/24/2024
4.0.230 165 8/23/2024
4.0.229 172 8/21/2024
4.0.228 166 8/21/2024
4.0.227 158 8/20/2024
4.0.226 153 8/19/2024
4.0.225 166 8/16/2024
4.0.224 158 8/16/2024
4.0.223 167 8/14/2024
4.0.222 158 8/5/2024
4.0.221 111 8/2/2024
4.0.220 114 8/1/2024
4.0.219 123 7/31/2024
4.0.218 141 7/26/2024
4.0.217 139 7/25/2024
4.0.216 117 7/25/2024
4.0.215 148 7/11/2024
4.0.214 159 7/10/2024
4.0.213 165 7/9/2024
4.0.212 133 7/9/2024
4.0.211 149 7/9/2024
4.0.210 143 7/5/2024
4.0.209 146 7/4/2024
4.0.208 170 7/3/2024
4.0.207 146 7/2/2024
4.0.206 155 6/27/2024
4.0.205 149 6/26/2024
4.0.204 151 6/25/2024
4.0.203 145 6/24/2024
4.0.202 1,018 6/19/2024
4.0.201 156 6/19/2024
4.0.200 152 6/17/2024
4.0.199 152 6/14/2024
4.0.198 144 6/14/2024
4.0.197 129 6/12/2024
4.0.196 153 6/3/2024
4.0.195 145 5/31/2024
4.0.194 128 5/30/2024
4.0.193 148 5/29/2024
4.0.192 135 5/28/2024
4.0.191 143 5/27/2024
4.0.190 149 5/23/2024
4.0.189 149 5/22/2024
4.0.188 155 5/21/2024
4.0.187 165 5/20/2024
4.0.186 158 5/18/2024
4.0.185 155 5/16/2024
4.0.184 152 5/15/2024
4.0.183 153 5/8/2024
4.0.182 170 5/7/2024
4.0.181 171 5/6/2024
4.0.180 147 5/3/2024
4.0.179 680 5/2/2024
4.0.178 132 5/2/2024
4.0.177 152 5/1/2024
4.0.176 160 4/29/2024
4.0.175 145 4/29/2024
4.0.174 153 4/25/2024
4.0.173 168 4/24/2024
4.0.172 159 4/16/2024
4.0.171 154 4/15/2024
4.0.170 170 4/13/2024
4.0.169 146 4/12/2024
4.0.168 162 4/11/2024
4.0.167 159 4/10/2024
4.0.166 148 4/9/2024
4.0.165 168 4/9/2024
4.0.164 153 4/1/2024
4.0.163 151 3/29/2024
4.0.162 157 3/29/2024
4.0.161 161 3/27/2024
4.0.160 150 3/22/2024
4.0.159 159 3/22/2024
4.0.158 171 3/18/2024
4.0.157 163 3/15/2024
4.0.156 151 3/14/2024
4.0.155 161 3/14/2024
4.0.154 162 3/11/2024
4.0.153 168 3/8/2024
4.0.152 159 3/7/2024
4.0.151 171 3/6/2024
4.0.150 182 3/5/2024
4.0.149 182 3/4/2024
4.0.148 1,005 3/2/2024
4.0.147 172 2/29/2024
4.0.146 146 2/29/2024
4.0.145 158 2/27/2024
4.0.144 149 2/26/2024
4.0.143 155 2/23/2024
4.0.142 165 2/22/2024
4.0.141 163 2/22/2024
4.0.140 162 2/21/2024
4.0.139 166 2/20/2024
4.0.138 156 2/19/2024
4.0.137 162 2/19/2024
4.0.136 159 2/16/2024
4.0.135 154 2/16/2024
4.0.134 160 2/15/2024
4.0.133 179 2/14/2024
4.0.132 160 2/14/2024
4.0.131 161 2/13/2024
4.0.130 182 2/9/2024
4.0.129 171 2/9/2024
4.0.128 162 2/7/2024
4.0.127 148 2/6/2024
4.0.126 159 2/6/2024
4.0.125 155 2/5/2024
4.0.124 155 2/3/2024
4.0.123 165 2/1/2024
4.0.122 140 2/1/2024
4.0.121 153 1/31/2024
4.0.120 159 1/29/2024
4.0.119 148 1/25/2024
4.0.118 151 1/24/2024
4.0.117 156 1/23/2024
4.0.116 161 1/22/2024
4.0.115 1,063 1/17/2024
4.0.114 151 1/16/2024
4.0.113 152 1/15/2024
4.0.112 154 1/12/2024
4.0.111 163 1/11/2024
4.0.110 168 1/10/2024
4.0.109 350 1/8/2024
4.0.108 176 1/6/2024
4.0.107 311 12/26/2023
4.0.106 144 12/26/2023
4.0.105 150 12/26/2023
4.0.104 183 12/25/2023
4.0.103 159 12/23/2023
4.0.102 164 12/21/2023
4.0.101 174 12/15/2023
4.0.100 159 12/14/2023
4.0.99 161 12/13/2023
4.0.98 167 12/13/2023
4.0.97 509 12/12/2023
4.0.96 156 12/12/2023
4.0.95 149 12/12/2023
4.0.94 151 12/11/2023
4.0.93 224 12/6/2023
4.0.92 164 12/6/2023
4.0.91 165 12/6/2023
4.0.90 150 12/4/2023
4.0.89 299 11/24/2023
4.0.88 164 11/24/2023
4.0.87 161 11/21/2023
4.0.86 161 11/20/2023
4.0.85 141 11/20/2023
4.0.84 197 11/17/2023
4.0.83 666 11/17/2023
4.0.82 178 11/15/2023
4.0.81 162 11/13/2023
4.0.80 188 11/9/2023
4.0.79 203 11/9/2023
4.0.78 149 11/8/2023
4.0.77 160 11/7/2023
4.0.76 169 11/6/2023
4.0.75 176 11/3/2023
4.0.74 204 11/2/2023
4.0.73 176 11/1/2023
4.0.72 182 10/31/2023
4.0.71 158 10/31/2023
4.0.70 151 10/30/2023
4.0.69 188 10/28/2023
4.0.68 176 10/26/2023
4.0.67 183 10/25/2023
4.0.66 180 10/17/2023
4.0.65 170 10/16/2023
4.0.64 152 10/16/2023
4.0.63 196 10/13/2023
4.0.62 195 10/12/2023
4.0.61 185 10/11/2023
4.0.60 215 10/5/2023
4.0.59 186 10/4/2023
4.0.58 198 9/26/2023
4.0.57 182 9/26/2023
4.0.56 187 9/22/2023
4.0.55 192 9/20/2023
4.0.54 201 9/19/2023
4.0.53 191 9/18/2023
4.0.52 174 9/18/2023
4.0.51 232 9/15/2023
4.0.50 188 9/14/2023
4.0.49 190 9/12/2023
4.0.48 260 9/12/2023
4.0.47 179 9/11/2023
4.0.46 214 9/11/2023
4.0.45 322 9/7/2023
4.0.44 215 9/6/2023
4.0.43 247 9/5/2023
4.0.42 211 9/4/2023
4.0.41 194 9/4/2023
4.0.40 234 9/1/2023
4.0.39 236 8/31/2023
4.0.38 227 8/31/2023
4.0.37 231 8/29/2023
4.0.36 209 8/29/2023
4.0.35 238 8/29/2023
4.0.34 243 8/25/2023
4.0.33 229 8/24/2023
4.0.32 231 8/23/2023
4.0.31 240 8/22/2023
4.0.30 228 8/18/2023
4.0.29 216 8/17/2023
4.0.28 245 8/17/2023
4.0.27 196 8/17/2023
4.0.26 316 8/10/2023
4.0.25 243 8/9/2023
4.0.24 252 8/8/2023
4.0.23 226 8/8/2023
4.0.22 213 8/8/2023
4.0.21 337 8/7/2023
4.0.20 240 8/4/2023
4.0.19 296 8/3/2023
4.0.18 243 8/2/2023
4.0.17 274 7/26/2023
4.0.16 267 7/25/2023
4.0.15 278 7/21/2023
4.0.14 236 7/19/2023
4.0.13 238 7/18/2023
4.0.12 216 7/18/2023
4.0.11 267 7/18/2023
4.0.10 214 7/18/2023
4.0.9 316 7/17/2023
4.0.8 235 7/17/2023
4.0.7 215 7/17/2023
4.0.6 224 7/17/2023
4.0.5 539 1/30/2023
4.0.4 326 1/30/2023
4.0.3 425 1/30/2023
4.0.2 428 1/27/2023
4.0.1 606 12/13/2022
4.0.0 364 12/12/2022
3.0.43 1,569 6/10/2022
3.0.41 1,006 4/20/2022
3.0.40 1,046 1/11/2022
3.0.39 831 1/10/2022
3.0.38 1,108 6/17/2021
3.0.37 820 6/16/2021
3.0.36 766 6/16/2021
3.0.35 553 6/16/2021
3.0.34 529 6/16/2021
3.0.33 1,008 1/7/2021
3.0.32 838 12/16/2020
3.0.31 783 12/14/2020
3.0.29 2,374 9/13/2020
3.0.28 926 6/19/2020
3.0.27 931 6/8/2020
3.0.26 1,688 5/12/2020
3.0.25 1,454 5/12/2020
3.0.24 930 4/28/2020
3.0.23 933 4/24/2020
3.0.22 933 4/16/2020
3.0.21 939 4/16/2020
3.0.20 665 4/15/2020
3.0.19 648 4/15/2020
3.0.18 1,195 4/14/2020
3.0.17 648 4/14/2020
3.0.16 985 4/10/2020
3.0.15 1,011 4/10/2020
3.0.14 3,107 3/26/2020
3.0.13 926 3/26/2020
3.0.12 671 3/25/2020
3.0.11 652 3/25/2020
3.0.10 645 3/25/2020
3.0.9 685 3/25/2020
3.0.8 678 3/25/2020
3.0.7 1,166 3/25/2020
3.0.6 1,341 3/21/2020
3.0.5 1,678 3/13/2020
3.0.4 710 3/13/2020
3.0.3 1,405 2/28/2020
3.0.2 1,222 2/21/2020
3.0.1 729 2/11/2020
3.0.0 1,898 12/23/2019
2.0.10 1,132 4/17/2019
2.0.9 1,652 2/21/2019
2.0.8 830 2/21/2019
2.0.7 4,038 8/1/2018
2.0.6 1,399 8/1/2018
2.0.5 1,710 6/26/2018
2.0.4 1,892 6/1/2018
2.0.3 1,851 5/22/2018
2.0.2 2,417 5/11/2018
2.0.1 2,485 2/13/2018
2.0.0 2,402 1/2/2018
1.0.10 14,137 6/16/2017
1.0.8 1,258 6/16/2017
1.0.7 1,223 5/30/2017
1.0.6 1,196 5/30/2017
1.0.5 1,207 5/25/2017
1.0.4 1,230 5/24/2017
1.0.0 1,261 5/24/2017