Holmes 5.0.43

There is a newer version of this package available.
See the version list below for details.
dotnet add package Holmes --version 5.0.43
                    
NuGet\Install-Package Holmes -Version 5.0.43
                    
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.43" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Holmes" Version="5.0.43" />
                    
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.43
                    
#r "nuget: Holmes, 5.0.43"
                    
#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.43
                    
#: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.43
                    
Install as a Cake Addin
#tool nuget:?package=Holmes&version=5.0.43
                    
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.70 199 8/20/2025
5.0.69 127 8/20/2025
5.0.68 127 8/20/2025
5.0.67 130 8/19/2025
5.0.66 128 8/19/2025
5.0.65 128 8/19/2025
5.0.64 138 8/15/2025
5.0.63 288 8/6/2025
5.0.62 244 8/5/2025
5.0.61 219 8/5/2025
5.0.60 222 8/5/2025
5.0.59 224 8/5/2025
5.0.58 207 8/5/2025
5.0.57 129 8/1/2025
5.0.56 109 7/29/2025
5.0.55 98 7/29/2025
5.0.54 131 7/17/2025
5.0.53 134 7/16/2025
5.0.52 165 7/15/2025
5.0.51 142 7/15/2025
5.0.50 136 7/15/2025
5.0.49 164 7/8/2025
5.0.48 264 7/1/2025
5.0.47 141 7/1/2025
5.0.46 145 7/1/2025
5.0.45 150 6/28/2025
5.0.44 73 6/27/2025
5.0.43 188 6/27/2025
5.0.42 186 6/26/2025
5.0.41 152 6/18/2025
5.0.40 295 6/10/2025
5.0.39 87 5/30/2025
5.0.38 95 5/23/2025
5.0.37 240 5/14/2025
5.0.36 92 5/2/2025
5.0.35 178 4/29/2025
5.0.34 206 4/10/2025
5.0.33 178 3/17/2025
5.0.32 136 2/24/2025
5.0.31 162 2/13/2025
5.0.30 273 2/3/2025
5.0.29 173 1/30/2025
5.0.28 133 1/29/2025
5.0.27 142 1/29/2025
5.0.26 153 1/28/2025
5.0.25 147 1/24/2025
5.0.24 139 1/23/2025
5.0.23 147 1/22/2025
5.0.22 149 1/16/2025
5.0.21 136 1/15/2025
5.0.20 85 1/14/2025
5.0.19 101 1/13/2025
5.0.18 120 1/10/2025
5.0.17 105 1/9/2025
5.0.16 84 1/8/2025
5.0.15 210 12/17/2024
5.0.14 156 12/16/2024
5.0.13 161 12/10/2024
5.0.12 146 12/9/2024
5.0.11 152 12/6/2024
5.0.10 198 11/27/2024
5.0.9 136 11/26/2024
5.0.8 168 11/26/2024
5.0.7 166 11/24/2024
5.0.6 134 11/24/2024
5.0.5 128 11/23/2024
5.0.4 130 11/23/2024
4.0.270 152 11/19/2024
4.0.269 143 11/11/2024
4.0.268 127 11/7/2024
4.0.267 131 11/5/2024
4.0.266 126 11/4/2024
4.0.265 142 11/1/2024
4.0.264 128 11/1/2024
4.0.263 132 10/30/2024
4.0.262 139 10/29/2024
4.0.261 132 10/29/2024
4.0.260 137 10/26/2024
4.0.259 142 10/24/2024
4.0.258 144 10/21/2024
4.0.257 149 10/17/2024
4.0.256 139 10/15/2024
4.0.255 140 10/11/2024
4.0.254 136 10/10/2024
4.0.253 132 10/9/2024
4.0.252 143 10/9/2024
4.0.251 182 10/3/2024
4.0.250 154 10/2/2024
4.0.249 157 9/30/2024
4.0.248 149 9/28/2024
4.0.247 135 9/24/2024
4.0.246 141 9/23/2024
4.0.245 138 9/23/2024
4.0.244 182 9/17/2024
4.0.243 162 9/16/2024
4.0.242 158 9/10/2024
4.0.241 144 9/9/2024
4.0.240 147 9/6/2024
4.0.239 145 9/6/2024
4.0.238 154 9/3/2024
4.0.237 158 9/2/2024
4.0.236 145 8/30/2024
4.0.235 150 8/30/2024
4.0.234 154 8/28/2024
4.0.233 161 8/27/2024
4.0.232 151 8/26/2024
4.0.231 180 8/24/2024
4.0.230 171 8/23/2024
4.0.229 179 8/21/2024
4.0.228 176 8/21/2024
4.0.227 164 8/20/2024
4.0.226 159 8/19/2024
4.0.225 173 8/16/2024
4.0.224 166 8/16/2024
4.0.223 174 8/14/2024
4.0.222 167 8/5/2024
4.0.221 118 8/2/2024
4.0.220 121 8/1/2024
4.0.219 131 7/31/2024
4.0.218 147 7/26/2024
4.0.217 146 7/25/2024
4.0.216 123 7/25/2024
4.0.215 154 7/11/2024
4.0.214 166 7/10/2024
4.0.213 172 7/9/2024
4.0.212 143 7/9/2024
4.0.211 156 7/9/2024
4.0.210 150 7/5/2024
4.0.209 154 7/4/2024
4.0.208 176 7/3/2024
4.0.207 152 7/2/2024
4.0.206 161 6/27/2024
4.0.205 158 6/26/2024
4.0.204 157 6/25/2024
4.0.203 151 6/24/2024
4.0.202 1,024 6/19/2024
4.0.201 162 6/19/2024
4.0.200 158 6/17/2024
4.0.199 159 6/14/2024
4.0.198 150 6/14/2024
4.0.197 135 6/12/2024
4.0.196 161 6/3/2024
4.0.195 151 5/31/2024
4.0.194 134 5/30/2024
4.0.193 155 5/29/2024
4.0.192 141 5/28/2024
4.0.191 150 5/27/2024
4.0.190 157 5/23/2024
4.0.189 157 5/22/2024
4.0.188 162 5/21/2024
4.0.187 171 5/20/2024
4.0.186 165 5/18/2024
4.0.185 162 5/16/2024
4.0.184 159 5/15/2024
4.0.183 160 5/8/2024
4.0.182 177 5/7/2024
4.0.181 177 5/6/2024
4.0.180 154 5/3/2024
4.0.179 689 5/2/2024
4.0.178 139 5/2/2024
4.0.177 158 5/1/2024
4.0.176 167 4/29/2024
4.0.175 153 4/29/2024
4.0.174 161 4/25/2024
4.0.173 174 4/24/2024
4.0.172 167 4/16/2024
4.0.171 160 4/15/2024
4.0.170 178 4/13/2024
4.0.169 152 4/12/2024
4.0.168 169 4/11/2024
4.0.167 165 4/10/2024
4.0.166 154 4/9/2024
4.0.165 174 4/9/2024
4.0.164 159 4/1/2024
4.0.163 157 3/29/2024
4.0.162 163 3/29/2024
4.0.161 167 3/27/2024
4.0.160 158 3/22/2024
4.0.159 166 3/22/2024
4.0.158 177 3/18/2024
4.0.157 169 3/15/2024
4.0.156 159 3/14/2024
4.0.155 168 3/14/2024
4.0.154 168 3/11/2024
4.0.153 174 3/8/2024
4.0.152 166 3/7/2024
4.0.151 179 3/6/2024
4.0.150 189 3/5/2024
4.0.149 188 3/4/2024
4.0.148 1,011 3/2/2024
4.0.147 181 2/29/2024
4.0.146 152 2/29/2024
4.0.145 164 2/27/2024
4.0.144 155 2/26/2024
4.0.143 161 2/23/2024
4.0.142 171 2/22/2024
4.0.141 169 2/22/2024
4.0.140 169 2/21/2024
4.0.139 172 2/20/2024
4.0.138 163 2/19/2024
4.0.137 168 2/19/2024
4.0.136 165 2/16/2024
4.0.135 160 2/16/2024
4.0.134 167 2/15/2024
4.0.133 185 2/14/2024
4.0.132 167 2/14/2024
4.0.131 168 2/13/2024
4.0.130 188 2/9/2024
4.0.129 177 2/9/2024
4.0.128 168 2/7/2024
4.0.127 154 2/6/2024
4.0.126 165 2/6/2024
4.0.125 161 2/5/2024
4.0.124 162 2/3/2024
4.0.123 171 2/1/2024
4.0.122 147 2/1/2024
4.0.121 159 1/31/2024
4.0.120 166 1/29/2024
4.0.119 155 1/25/2024
4.0.118 158 1/24/2024
4.0.117 162 1/23/2024
4.0.116 168 1/22/2024
4.0.115 1,069 1/17/2024
4.0.114 157 1/16/2024
4.0.113 159 1/15/2024
4.0.112 161 1/12/2024
4.0.111 170 1/11/2024
4.0.110 175 1/10/2024
4.0.109 357 1/8/2024
4.0.108 183 1/6/2024
4.0.107 318 12/26/2023
4.0.106 150 12/26/2023
4.0.105 157 12/26/2023
4.0.104 189 12/25/2023
4.0.103 167 12/23/2023
4.0.102 170 12/21/2023
4.0.101 180 12/15/2023
4.0.100 165 12/14/2023
4.0.99 168 12/13/2023
4.0.98 173 12/13/2023
4.0.97 515 12/12/2023
4.0.96 162 12/12/2023
4.0.95 155 12/12/2023
4.0.94 161 12/11/2023
4.0.93 228 12/6/2023
4.0.92 169 12/6/2023
4.0.91 170 12/6/2023
4.0.90 155 12/4/2023
4.0.89 303 11/24/2023
4.0.88 169 11/24/2023
4.0.87 165 11/21/2023
4.0.86 166 11/20/2023
4.0.85 145 11/20/2023
4.0.84 201 11/17/2023
4.0.83 671 11/17/2023
4.0.82 182 11/15/2023
4.0.81 166 11/13/2023
4.0.80 194 11/9/2023
4.0.79 207 11/9/2023
4.0.78 153 11/8/2023
4.0.77 164 11/7/2023
4.0.76 173 11/6/2023
4.0.75 180 11/3/2023
4.0.74 208 11/2/2023
4.0.73 182 11/1/2023
4.0.72 187 10/31/2023
4.0.71 163 10/31/2023
4.0.70 155 10/30/2023
4.0.69 194 10/28/2023
4.0.68 181 10/26/2023
4.0.67 187 10/25/2023
4.0.66 184 10/17/2023
4.0.65 174 10/16/2023
4.0.64 157 10/16/2023
4.0.63 201 10/13/2023
4.0.62 199 10/12/2023
4.0.61 190 10/11/2023
4.0.60 220 10/5/2023
4.0.59 191 10/4/2023
4.0.58 205 9/26/2023
4.0.57 187 9/26/2023
4.0.56 193 9/22/2023
4.0.55 196 9/20/2023
4.0.54 205 9/19/2023
4.0.53 197 9/18/2023
4.0.52 179 9/18/2023
4.0.51 239 9/15/2023
4.0.50 195 9/14/2023
4.0.49 195 9/12/2023
4.0.48 266 9/12/2023
4.0.47 191 9/11/2023
4.0.46 220 9/11/2023
4.0.45 330 9/7/2023
4.0.44 221 9/6/2023
4.0.43 254 9/5/2023
4.0.42 218 9/4/2023
4.0.41 200 9/4/2023
4.0.40 240 9/1/2023
4.0.39 242 8/31/2023
4.0.38 234 8/31/2023
4.0.37 237 8/29/2023
4.0.36 215 8/29/2023
4.0.35 244 8/29/2023
4.0.34 250 8/25/2023
4.0.33 235 8/24/2023
4.0.32 238 8/23/2023
4.0.31 246 8/22/2023
4.0.30 234 8/18/2023
4.0.29 224 8/17/2023
4.0.28 250 8/17/2023
4.0.27 202 8/17/2023
4.0.26 325 8/10/2023
4.0.25 250 8/9/2023
4.0.24 260 8/8/2023
4.0.23 233 8/8/2023
4.0.22 219 8/8/2023
4.0.21 344 8/7/2023
4.0.20 246 8/4/2023
4.0.19 302 8/3/2023
4.0.18 249 8/2/2023
4.0.17 281 7/26/2023
4.0.16 273 7/25/2023
4.0.15 285 7/21/2023
4.0.14 243 7/19/2023
4.0.13 244 7/18/2023
4.0.12 223 7/18/2023
4.0.11 274 7/18/2023
4.0.10 220 7/18/2023
4.0.9 322 7/17/2023
4.0.8 241 7/17/2023
4.0.7 221 7/17/2023
4.0.6 231 7/17/2023
4.0.5 546 1/30/2023
4.0.4 335 1/30/2023
4.0.3 432 1/30/2023
4.0.2 435 1/27/2023
4.0.1 613 12/13/2022
4.0.0 372 12/12/2022
3.0.43 1,576 6/10/2022
3.0.41 1,015 4/20/2022
3.0.40 1,053 1/11/2022
3.0.39 838 1/10/2022
3.0.38 1,116 6/17/2021
3.0.37 829 6/16/2021
3.0.36 774 6/16/2021
3.0.35 561 6/16/2021
3.0.34 537 6/16/2021
3.0.33 1,018 1/7/2021
3.0.32 848 12/16/2020
3.0.31 794 12/14/2020
3.0.29 2,384 9/13/2020
3.0.28 937 6/19/2020
3.0.27 941 6/8/2020
3.0.26 1,699 5/12/2020
3.0.25 1,464 5/12/2020
3.0.24 942 4/28/2020
3.0.23 943 4/24/2020
3.0.22 944 4/16/2020
3.0.21 950 4/16/2020
3.0.20 675 4/15/2020
3.0.19 659 4/15/2020
3.0.18 1,206 4/14/2020
3.0.17 660 4/14/2020
3.0.16 996 4/10/2020
3.0.15 1,021 4/10/2020
3.0.14 3,117 3/26/2020
3.0.13 937 3/26/2020
3.0.12 681 3/25/2020
3.0.11 663 3/25/2020
3.0.10 656 3/25/2020
3.0.9 696 3/25/2020
3.0.8 690 3/25/2020
3.0.7 1,176 3/25/2020
3.0.6 1,352 3/21/2020
3.0.5 1,689 3/13/2020
3.0.4 721 3/13/2020
3.0.3 1,415 2/28/2020
3.0.2 1,233 2/21/2020
3.0.1 740 2/11/2020
3.0.0 1,908 12/23/2019
2.0.10 1,142 4/17/2019
2.0.9 1,664 2/21/2019
2.0.8 840 2/21/2019
2.0.7 4,054 8/1/2018
2.0.6 1,415 8/1/2018
2.0.5 1,726 6/26/2018
2.0.4 1,916 6/1/2018
2.0.3 1,875 5/22/2018
2.0.2 2,448 5/11/2018
2.0.1 2,509 2/13/2018
2.0.0 2,428 1/2/2018
1.0.10 14,153 6/16/2017
1.0.8 1,274 6/16/2017
1.0.7 1,240 5/30/2017
1.0.6 1,212 5/30/2017
1.0.5 1,224 5/25/2017
1.0.4 1,246 5/24/2017
1.0.0 1,277 5/24/2017