Holmes 5.0.15

There is a newer version of this package available.
See the version list below for details.
dotnet add package Holmes --version 5.0.15                
NuGet\Install-Package Holmes -Version 5.0.15                
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.15" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Holmes --version 5.0.15                
#r "nuget: Holmes, 5.0.15"                
#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.
// Install Holmes as a Cake Addin
#addin nuget:?package=Holmes&version=5.0.15

// Install Holmes as a Cake Tool
#tool nuget:?package=Holmes&version=5.0.15                

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. 
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.20 0 1/14/2025
5.0.19 38 1/13/2025
5.0.18 50 1/10/2025
5.0.17 32 1/9/2025
5.0.16 9 1/8/2025
5.0.15 161 12/17/2024
5.0.14 107 12/16/2024
5.0.13 116 12/10/2024
5.0.12 102 12/9/2024
5.0.11 107 12/6/2024
5.0.10 156 11/27/2024
5.0.9 90 11/26/2024
5.0.8 126 11/26/2024
5.0.7 116 11/24/2024
5.0.6 90 11/24/2024
5.0.5 83 11/23/2024
5.0.4 85 11/23/2024
4.0.270 107 11/19/2024
4.0.269 97 11/11/2024
4.0.268 81 11/7/2024
4.0.267 87 11/5/2024
4.0.266 83 11/4/2024
4.0.265 95 11/1/2024
4.0.264 84 11/1/2024
4.0.263 90 10/30/2024
4.0.262 97 10/29/2024
4.0.261 89 10/29/2024
4.0.260 95 10/26/2024
4.0.259 97 10/24/2024
4.0.258 100 10/21/2024
4.0.257 114 10/17/2024
4.0.256 100 10/15/2024
4.0.255 100 10/11/2024
4.0.254 98 10/10/2024
4.0.253 92 10/9/2024
4.0.252 103 10/9/2024
4.0.251 123 10/3/2024
4.0.250 113 10/2/2024
4.0.249 115 9/30/2024
4.0.248 106 9/28/2024
4.0.247 93 9/24/2024
4.0.246 98 9/23/2024
4.0.245 96 9/23/2024
4.0.244 139 9/17/2024
4.0.243 120 9/16/2024
4.0.242 122 9/10/2024
4.0.241 108 9/9/2024
4.0.240 108 9/6/2024
4.0.239 105 9/6/2024
4.0.238 114 9/3/2024
4.0.237 118 9/2/2024
4.0.236 109 8/30/2024
4.0.235 114 8/30/2024
4.0.234 111 8/28/2024
4.0.233 123 8/27/2024
4.0.232 109 8/26/2024
4.0.231 140 8/24/2024
4.0.230 136 8/23/2024
4.0.229 136 8/21/2024
4.0.228 133 8/21/2024
4.0.227 127 8/20/2024
4.0.226 124 8/19/2024
4.0.225 131 8/16/2024
4.0.224 129 8/16/2024
4.0.223 134 8/14/2024
4.0.222 113 8/5/2024
4.0.221 83 8/2/2024
4.0.220 82 8/1/2024
4.0.219 90 7/31/2024
4.0.218 111 7/26/2024
4.0.217 98 7/25/2024
4.0.216 84 7/25/2024
4.0.215 115 7/11/2024
4.0.214 122 7/10/2024
4.0.213 134 7/9/2024
4.0.212 103 7/9/2024
4.0.211 119 7/9/2024
4.0.210 112 7/5/2024
4.0.209 110 7/4/2024
4.0.208 137 7/3/2024
4.0.207 113 7/2/2024
4.0.206 123 6/27/2024
4.0.205 119 6/26/2024
4.0.204 118 6/25/2024
4.0.203 115 6/24/2024
4.0.202 979 6/19/2024
4.0.201 124 6/19/2024
4.0.200 125 6/17/2024
4.0.199 123 6/14/2024
4.0.198 112 6/14/2024
4.0.197 101 6/12/2024
4.0.196 122 6/3/2024
4.0.195 114 5/31/2024
4.0.194 97 5/30/2024
4.0.193 117 5/29/2024
4.0.192 105 5/28/2024
4.0.191 112 5/27/2024
4.0.190 121 5/23/2024
4.0.189 119 5/22/2024
4.0.188 127 5/21/2024
4.0.187 134 5/20/2024
4.0.186 125 5/18/2024
4.0.185 125 5/16/2024
4.0.184 125 5/15/2024
4.0.183 117 5/8/2024
4.0.182 140 5/7/2024
4.0.181 143 5/6/2024
4.0.180 118 5/3/2024
4.0.179 647 5/2/2024
4.0.178 101 5/2/2024
4.0.177 122 5/1/2024
4.0.176 132 4/29/2024
4.0.175 115 4/29/2024
4.0.174 121 4/25/2024
4.0.173 137 4/24/2024
4.0.172 127 4/16/2024
4.0.171 121 4/15/2024
4.0.170 141 4/13/2024
4.0.169 114 4/12/2024
4.0.168 131 4/11/2024
4.0.167 128 4/10/2024
4.0.166 119 4/9/2024
4.0.165 136 4/9/2024
4.0.164 126 4/1/2024
4.0.163 123 3/29/2024
4.0.162 124 3/29/2024
4.0.161 127 3/27/2024
4.0.160 122 3/22/2024
4.0.159 130 3/22/2024
4.0.158 134 3/18/2024
4.0.157 135 3/15/2024
4.0.156 123 3/14/2024
4.0.155 129 3/14/2024
4.0.154 132 3/11/2024
4.0.153 136 3/8/2024
4.0.152 132 3/7/2024
4.0.151 141 3/6/2024
4.0.150 154 3/5/2024
4.0.149 151 3/4/2024
4.0.148 968 3/2/2024
4.0.147 142 2/29/2024
4.0.146 117 2/29/2024
4.0.145 128 2/27/2024
4.0.144 121 2/26/2024
4.0.143 120 2/23/2024
4.0.142 132 2/22/2024
4.0.141 132 2/22/2024
4.0.140 125 2/21/2024
4.0.139 132 2/20/2024
4.0.138 119 2/19/2024
4.0.137 126 2/19/2024
4.0.136 124 2/16/2024
4.0.135 121 2/16/2024
4.0.134 127 2/15/2024
4.0.133 148 2/14/2024
4.0.132 131 2/14/2024
4.0.131 129 2/13/2024
4.0.130 149 2/9/2024
4.0.129 139 2/9/2024
4.0.128 134 2/7/2024
4.0.127 122 2/6/2024
4.0.126 130 2/6/2024
4.0.125 125 2/5/2024
4.0.124 130 2/3/2024
4.0.123 134 2/1/2024
4.0.122 113 2/1/2024
4.0.121 115 1/31/2024
4.0.120 130 1/29/2024
4.0.119 118 1/25/2024
4.0.118 118 1/24/2024
4.0.117 127 1/23/2024
4.0.116 128 1/22/2024
4.0.115 1,034 1/17/2024
4.0.114 123 1/16/2024
4.0.113 122 1/15/2024
4.0.112 127 1/12/2024
4.0.111 132 1/11/2024
4.0.110 132 1/10/2024
4.0.109 321 1/8/2024
4.0.108 147 1/6/2024
4.0.107 286 12/26/2023
4.0.106 118 12/26/2023
4.0.105 122 12/26/2023
4.0.104 149 12/25/2023
4.0.103 132 12/23/2023
4.0.102 133 12/21/2023
4.0.101 146 12/15/2023
4.0.100 128 12/14/2023
4.0.99 135 12/13/2023
4.0.98 141 12/13/2023
4.0.97 477 12/12/2023
4.0.96 131 12/12/2023
4.0.95 121 12/12/2023
4.0.94 121 12/11/2023
4.0.93 210 12/6/2023
4.0.92 152 12/6/2023
4.0.91 152 12/6/2023
4.0.90 133 12/4/2023
4.0.89 287 11/24/2023
4.0.88 153 11/24/2023
4.0.87 147 11/21/2023
4.0.86 149 11/20/2023
4.0.85 131 11/20/2023
4.0.84 183 11/17/2023
4.0.83 499 11/17/2023
4.0.82 161 11/15/2023
4.0.81 148 11/13/2023
4.0.80 175 11/9/2023
4.0.79 188 11/9/2023
4.0.78 137 11/8/2023
4.0.77 147 11/7/2023
4.0.76 155 11/6/2023
4.0.75 160 11/3/2023
4.0.74 191 11/2/2023
4.0.73 164 11/1/2023
4.0.72 168 10/31/2023
4.0.71 144 10/31/2023
4.0.70 137 10/30/2023
4.0.69 172 10/28/2023
4.0.68 156 10/26/2023
4.0.67 162 10/25/2023
4.0.66 161 10/17/2023
4.0.65 149 10/16/2023
4.0.64 130 10/16/2023
4.0.63 175 10/13/2023
4.0.62 177 10/12/2023
4.0.61 163 10/11/2023
4.0.60 194 10/5/2023
4.0.59 166 10/4/2023
4.0.58 178 9/26/2023
4.0.57 160 9/26/2023
4.0.56 166 9/22/2023
4.0.55 171 9/20/2023
4.0.54 176 9/19/2023
4.0.53 171 9/18/2023
4.0.52 148 9/18/2023
4.0.51 209 9/15/2023
4.0.50 168 9/14/2023
4.0.49 168 9/12/2023
4.0.48 235 9/12/2023
4.0.47 155 9/11/2023
4.0.46 184 9/11/2023
4.0.45 289 9/7/2023
4.0.44 188 9/6/2023
4.0.43 221 9/5/2023
4.0.42 185 9/4/2023
4.0.41 166 9/4/2023
4.0.40 205 9/1/2023
4.0.39 207 8/31/2023
4.0.38 198 8/31/2023
4.0.37 202 8/29/2023
4.0.36 181 8/29/2023
4.0.35 207 8/29/2023
4.0.34 213 8/25/2023
4.0.33 197 8/24/2023
4.0.32 201 8/23/2023
4.0.31 209 8/22/2023
4.0.30 197 8/18/2023
4.0.29 187 8/17/2023
4.0.28 214 8/17/2023
4.0.27 167 8/17/2023
4.0.26 283 8/10/2023
4.0.25 210 8/9/2023
4.0.24 219 8/8/2023
4.0.23 193 8/8/2023
4.0.22 177 8/8/2023
4.0.21 305 8/7/2023
4.0.20 209 8/4/2023
4.0.19 261 8/3/2023
4.0.18 212 8/2/2023
4.0.17 243 7/26/2023
4.0.16 233 7/25/2023
4.0.15 242 7/21/2023
4.0.14 202 7/19/2023
4.0.13 200 7/18/2023
4.0.12 176 7/18/2023
4.0.11 233 7/18/2023
4.0.10 180 7/18/2023
4.0.9 278 7/17/2023
4.0.8 190 7/17/2023
4.0.7 179 7/17/2023
4.0.6 184 7/17/2023
4.0.5 497 1/30/2023
4.0.4 282 1/30/2023
4.0.3 382 1/30/2023
4.0.2 386 1/27/2023
4.0.1 562 12/13/2022
4.0.0 324 12/12/2022
3.0.43 1,515 6/10/2022
3.0.41 949 4/20/2022
3.0.40 987 1/11/2022
3.0.39 769 1/10/2022
3.0.38 1,036 6/17/2021
3.0.37 757 6/16/2021
3.0.36 702 6/16/2021
3.0.35 487 6/16/2021
3.0.34 466 6/16/2021
3.0.33 936 1/7/2021
3.0.32 767 12/16/2020
3.0.31 710 12/14/2020
3.0.29 2,300 9/13/2020
3.0.28 852 6/19/2020
3.0.27 857 6/8/2020
3.0.26 1,608 5/12/2020
3.0.25 1,374 5/12/2020
3.0.24 847 4/28/2020
3.0.23 854 4/24/2020
3.0.22 853 4/16/2020
3.0.21 858 4/16/2020
3.0.20 585 4/15/2020
3.0.19 568 4/15/2020
3.0.18 1,113 4/14/2020
3.0.17 564 4/14/2020
3.0.16 904 4/10/2020
3.0.15 931 4/10/2020
3.0.14 3,025 3/26/2020
3.0.13 844 3/26/2020
3.0.12 590 3/25/2020
3.0.11 572 3/25/2020
3.0.10 563 3/25/2020
3.0.9 604 3/25/2020
3.0.8 595 3/25/2020
3.0.7 1,086 3/25/2020
3.0.6 1,257 3/21/2020
3.0.5 1,596 3/13/2020
3.0.4 628 3/13/2020
3.0.3 1,321 2/28/2020
3.0.2 1,141 2/21/2020
3.0.1 640 2/11/2020
3.0.0 1,816 12/23/2019
2.0.10 1,044 4/17/2019
2.0.9 1,564 2/21/2019
2.0.8 742 2/21/2019
2.0.7 3,856 8/1/2018
2.0.6 1,216 8/1/2018
2.0.5 1,525 6/26/2018
2.0.4 1,614 6/1/2018
2.0.3 1,571 5/22/2018
2.0.2 2,125 5/11/2018
2.0.1 2,198 2/13/2018
2.0.0 2,107 1/2/2018
1.0.10 13,940 6/16/2017
1.0.8 1,062 6/16/2017
1.0.7 1,026 5/30/2017
1.0.6 1,001 5/30/2017
1.0.5 1,014 5/25/2017
1.0.4 1,033 5/24/2017
1.0.0 1,055 5/24/2017