Holmes 4.0.26

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

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

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 net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  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.32 90 9 days ago
5.0.31 113 21 days ago
5.0.30 154 a month ago
5.0.29 118 a month ago
5.0.28 92 a month ago
5.0.27 91 a month ago
5.0.26 106 a month ago
5.0.25 101 a month ago
5.0.24 101 a month ago
5.0.23 103 a month ago
5.0.22 104 2 months ago
5.0.21 97 2 months ago
5.0.20 39 2 months ago
5.0.19 61 2 months ago
5.0.18 82 2 months ago
5.0.17 61 2 months ago
5.0.16 44 2 months ago
5.0.15 170 3 months ago
5.0.14 115 3 months ago
5.0.13 122 3 months ago
5.0.12 109 3 months ago
5.0.11 114 3 months ago
5.0.10 160 3 months ago
5.0.9 94 3 months ago
5.0.8 129 3 months ago
5.0.7 121 3 months ago
5.0.6 93 3 months ago
5.0.5 88 3 months ago
5.0.4 92 3 months ago
4.0.270 112 3 months ago
4.0.269 102 4 months ago
4.0.268 88 4 months ago
4.0.267 91 4 months ago
4.0.266 90 4 months ago
4.0.265 98 4 months ago
4.0.264 90 4 months ago
4.0.263 93 4 months ago
4.0.262 100 4 months ago
4.0.261 93 4 months ago
4.0.260 100 4 months ago
4.0.259 101 4 months ago
4.0.258 105 4 months ago
4.0.257 117 5 months ago
4.0.256 105 5 months ago
4.0.255 105 5 months ago
4.0.254 102 5 months ago
4.0.253 97 5 months ago
4.0.252 106 5 months ago
4.0.251 140 5 months ago
4.0.250 116 5 months ago
4.0.249 119 5 months ago
4.0.248 109 5 months ago
4.0.247 99 5 months ago
4.0.246 103 5 months ago
4.0.245 100 5 months ago
4.0.244 145 6 months ago
4.0.243 124 6 months ago
4.0.242 124 6 months ago
4.0.241 110 6 months ago
4.0.240 112 6 months ago
4.0.239 108 6 months ago
4.0.238 115 6 months ago
4.0.237 125 6 months ago
4.0.236 112 6 months ago
4.0.235 115 6 months ago
4.0.234 113 6 months ago
4.0.233 125 6 months ago
4.0.232 113 6 months ago
4.0.231 142 6 months ago
4.0.230 137 6 months ago
4.0.229 137 6 months ago
4.0.228 136 6 months ago
4.0.227 130 6 months ago
4.0.226 126 6 months ago
4.0.225 135 7 months ago
4.0.224 131 7 months ago
4.0.223 136 7 months ago
4.0.222 122 7 months ago
4.0.221 84 7 months ago
4.0.220 86 7 months ago
4.0.219 94 7 months ago
4.0.218 116 7 months ago
4.0.217 101 7 months ago
4.0.216 87 7 months ago
4.0.215 117 8 months ago
4.0.214 124 8 months ago
4.0.213 136 8 months ago
4.0.212 106 8 months ago
4.0.211 121 8 months ago
4.0.210 114 8 months ago
4.0.209 114 8 months ago
4.0.208 139 8 months ago
4.0.207 115 8 months ago
4.0.206 125 8 months ago
4.0.205 122 8 months ago
4.0.204 120 8 months ago
4.0.203 117 8 months ago
4.0.202 990 8 months ago
4.0.201 126 8 months ago
4.0.200 127 9 months ago
4.0.199 125 9 months ago
4.0.198 116 9 months ago
4.0.197 103 9 months ago
4.0.196 124 9 months ago
4.0.195 116 9 months ago
4.0.194 100 9 months ago
4.0.193 119 9 months ago
4.0.192 107 9 months ago
4.0.191 114 9 months ago
4.0.190 123 9 months ago
4.0.189 121 9 months ago
4.0.188 129 9 months ago
4.0.187 138 9 months ago
4.0.186 127 10 months ago
4.0.185 127 10 months ago
4.0.184 127 10 months ago
4.0.183 122 10 months ago
4.0.182 142 10 months ago
4.0.181 145 10 months ago
4.0.180 120 5/3/2024
4.0.179 649 5/2/2024
4.0.178 103 5/2/2024
4.0.177 125 5/1/2024
4.0.176 135 4/29/2024
4.0.175 118 4/29/2024
4.0.174 124 4/25/2024
4.0.173 139 4/24/2024
4.0.172 129 4/16/2024
4.0.171 123 4/15/2024
4.0.170 144 4/13/2024
4.0.169 120 4/12/2024
4.0.168 135 4/11/2024
4.0.167 132 4/10/2024
4.0.166 122 4/9/2024
4.0.165 140 4/9/2024
4.0.164 129 4/1/2024
4.0.163 125 3/29/2024
4.0.162 129 3/29/2024
4.0.161 131 3/27/2024
4.0.160 124 3/22/2024
4.0.159 133 3/22/2024
4.0.158 137 3/18/2024
4.0.157 138 3/15/2024
4.0.156 125 3/14/2024
4.0.155 132 3/14/2024
4.0.154 136 3/11/2024
4.0.153 139 3/8/2024
4.0.152 135 3/7/2024
4.0.151 143 3/6/2024
4.0.150 157 3/5/2024
4.0.149 153 3/4/2024
4.0.148 974 3/2/2024
4.0.147 146 2/29/2024
4.0.146 120 2/29/2024
4.0.145 133 2/27/2024
4.0.144 123 2/26/2024
4.0.143 125 2/23/2024
4.0.142 134 2/22/2024
4.0.141 136 2/22/2024
4.0.140 129 2/21/2024
4.0.139 134 2/20/2024
4.0.138 128 2/19/2024
4.0.137 134 2/19/2024
4.0.136 132 2/16/2024
4.0.135 129 2/16/2024
4.0.134 129 2/15/2024
4.0.133 151 2/14/2024
4.0.132 132 2/14/2024
4.0.131 132 2/13/2024
4.0.130 151 2/9/2024
4.0.129 140 2/9/2024
4.0.128 137 2/7/2024
4.0.127 123 2/6/2024
4.0.126 131 2/6/2024
4.0.125 127 2/5/2024
4.0.124 131 2/3/2024
4.0.123 136 2/1/2024
4.0.122 114 2/1/2024
4.0.121 123 1/31/2024
4.0.120 131 1/29/2024
4.0.119 119 1/25/2024
4.0.118 120 1/24/2024
4.0.117 128 1/23/2024
4.0.116 130 1/22/2024
4.0.115 1,035 1/17/2024
4.0.114 124 1/16/2024
4.0.113 124 1/15/2024
4.0.112 128 1/12/2024
4.0.111 134 1/11/2024
4.0.110 133 1/10/2024
4.0.109 323 1/8/2024
4.0.108 150 1/6/2024
4.0.107 288 12/26/2023
4.0.106 120 12/26/2023
4.0.105 123 12/26/2023
4.0.104 156 12/25/2023
4.0.103 134 12/23/2023
4.0.102 136 12/21/2023
4.0.101 147 12/15/2023
4.0.100 130 12/14/2023
4.0.99 137 12/13/2023
4.0.98 142 12/13/2023
4.0.97 478 12/12/2023
4.0.96 132 12/12/2023
4.0.95 123 12/12/2023
4.0.94 125 12/11/2023
4.0.93 212 12/6/2023
4.0.92 154 12/6/2023
4.0.91 154 12/6/2023
4.0.90 135 12/4/2023
4.0.89 289 11/24/2023
4.0.88 154 11/24/2023
4.0.87 149 11/21/2023
4.0.86 151 11/20/2023
4.0.85 132 11/20/2023
4.0.84 186 11/17/2023
4.0.83 569 11/17/2023
4.0.82 164 11/15/2023
4.0.81 150 11/13/2023
4.0.80 176 11/9/2023
4.0.79 191 11/9/2023
4.0.78 138 11/8/2023
4.0.77 150 11/7/2023
4.0.76 159 11/6/2023
4.0.75 161 11/3/2023
4.0.74 193 11/2/2023
4.0.73 166 11/1/2023
4.0.72 169 10/31/2023
4.0.71 145 10/31/2023
4.0.70 140 10/30/2023
4.0.69 175 10/28/2023
4.0.68 159 10/26/2023
4.0.67 164 10/25/2023
4.0.66 163 10/17/2023
4.0.65 152 10/16/2023
4.0.64 132 10/16/2023
4.0.63 179 10/13/2023
4.0.62 179 10/12/2023
4.0.61 167 10/11/2023
4.0.60 196 10/5/2023
4.0.59 168 10/4/2023
4.0.58 180 9/26/2023
4.0.57 164 9/26/2023
4.0.56 170 9/22/2023
4.0.55 175 9/20/2023
4.0.54 178 9/19/2023
4.0.53 173 9/18/2023
4.0.52 150 9/18/2023
4.0.51 211 9/15/2023
4.0.50 170 9/14/2023
4.0.49 172 9/12/2023
4.0.48 237 9/12/2023
4.0.47 157 9/11/2023
4.0.46 188 9/11/2023
4.0.45 293 9/7/2023
4.0.44 190 9/6/2023
4.0.43 223 9/5/2023
4.0.42 187 9/4/2023
4.0.41 168 9/4/2023
4.0.40 207 9/1/2023
4.0.39 209 8/31/2023
4.0.38 202 8/31/2023
4.0.37 204 8/29/2023
4.0.36 183 8/29/2023
4.0.35 212 8/29/2023
4.0.34 215 8/25/2023
4.0.33 201 8/24/2023
4.0.32 205 8/23/2023
4.0.31 211 8/22/2023
4.0.30 201 8/18/2023
4.0.29 189 8/17/2023
4.0.28 217 8/17/2023
4.0.27 169 8/17/2023
4.0.26 286 8/10/2023
4.0.25 214 8/9/2023
4.0.24 223 8/8/2023
4.0.23 195 8/8/2023
4.0.22 181 8/8/2023
4.0.21 307 8/7/2023
4.0.20 212 8/4/2023
4.0.19 264 8/3/2023
4.0.18 214 8/2/2023
4.0.17 245 7/26/2023
4.0.16 237 7/25/2023
4.0.15 244 7/21/2023
4.0.14 204 7/19/2023
4.0.13 206 7/18/2023
4.0.12 179 7/18/2023
4.0.11 235 7/18/2023
4.0.10 182 7/18/2023
4.0.9 283 7/17/2023
4.0.8 200 7/17/2023
4.0.7 183 7/17/2023
4.0.6 188 7/17/2023
4.0.5 504 1/30/2023
4.0.4 289 1/30/2023
4.0.3 388 1/30/2023
4.0.2 392 1/27/2023
4.0.1 571 12/13/2022
4.0.0 330 12/12/2022
3.0.43 1,522 6/10/2022
3.0.41 956 4/20/2022
3.0.40 993 1/11/2022
3.0.39 775 1/10/2022
3.0.38 1,046 6/17/2021
3.0.37 765 6/16/2021
3.0.36 710 6/16/2021
3.0.35 495 6/16/2021
3.0.34 474 6/16/2021
3.0.33 946 1/7/2021
3.0.32 777 12/16/2020
3.0.31 720 12/14/2020
3.0.29 2,311 9/13/2020
3.0.28 863 6/19/2020
3.0.27 868 6/8/2020
3.0.26 1,620 5/12/2020
3.0.25 1,386 5/12/2020
3.0.24 861 4/28/2020
3.0.23 866 4/24/2020
3.0.22 865 4/16/2020
3.0.21 871 4/16/2020
3.0.20 597 4/15/2020
3.0.19 580 4/15/2020
3.0.18 1,125 4/14/2020
3.0.17 575 4/14/2020
3.0.16 916 4/10/2020
3.0.15 943 4/10/2020
3.0.14 3,037 3/26/2020
3.0.13 856 3/26/2020
3.0.12 603 3/25/2020
3.0.11 584 3/25/2020
3.0.10 575 3/25/2020
3.0.9 616 3/25/2020
3.0.8 608 3/25/2020
3.0.7 1,099 3/25/2020
3.0.6 1,270 3/21/2020
3.0.5 1,609 3/13/2020
3.0.4 641 3/13/2020
3.0.3 1,334 2/28/2020
3.0.2 1,154 2/21/2020
3.0.1 659 2/11/2020
3.0.0 1,829 12/23/2019
2.0.10 1,058 4/17/2019
2.0.9 1,578 2/21/2019
2.0.8 756 2/21/2019
2.0.7 3,888 8/1/2018
2.0.6 1,248 8/1/2018
2.0.5 1,558 6/26/2018
2.0.4 1,665 6/1/2018
2.0.3 1,624 5/22/2018
2.0.2 2,186 5/11/2018
2.0.1 2,259 2/13/2018
2.0.0 2,172 1/2/2018
1.0.10 13,982 6/16/2017
1.0.8 1,104 6/16/2017
1.0.7 1,068 5/30/2017
1.0.6 1,043 5/30/2017
1.0.5 1,056 5/25/2017
1.0.4 1,075 5/24/2017
1.0.0 1,103 5/24/2017