Holmes 4.0.17

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

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

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. 
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.10 72 11/27/2024
5.0.9 55 11/26/2024
5.0.8 95 11/26/2024
5.0.7 98 11/24/2024
5.0.6 73 11/24/2024
5.0.5 70 11/23/2024
5.0.4 74 11/23/2024
4.0.270 93 11/19/2024
4.0.269 81 11/11/2024
4.0.268 69 11/7/2024
4.0.267 73 11/5/2024
4.0.266 71 11/4/2024
4.0.265 79 11/1/2024
4.0.264 72 11/1/2024
4.0.263 78 10/30/2024
4.0.262 85 10/29/2024
4.0.261 77 10/29/2024
4.0.260 81 10/26/2024
4.0.259 80 10/24/2024
4.0.258 88 10/21/2024
4.0.257 104 10/17/2024
4.0.256 90 10/15/2024
4.0.255 92 10/11/2024
4.0.254 90 10/10/2024
4.0.253 84 10/9/2024
4.0.252 93 10/9/2024
4.0.251 117 10/3/2024
4.0.250 105 10/2/2024
4.0.249 106 9/30/2024
4.0.248 96 9/28/2024
4.0.247 85 9/24/2024
4.0.246 92 9/23/2024
4.0.245 88 9/23/2024
4.0.244 130 9/17/2024
4.0.243 110 9/16/2024
4.0.242 114 9/10/2024
4.0.241 100 9/9/2024
4.0.240 102 9/6/2024
4.0.239 97 9/6/2024
4.0.238 107 9/3/2024
4.0.237 110 9/2/2024
4.0.236 103 8/30/2024
4.0.235 106 8/30/2024
4.0.234 103 8/28/2024
4.0.233 115 8/27/2024
4.0.232 103 8/26/2024
4.0.231 132 8/24/2024
4.0.230 128 8/23/2024
4.0.229 128 8/21/2024
4.0.228 127 8/21/2024
4.0.227 121 8/20/2024
4.0.226 116 8/19/2024
4.0.225 125 8/16/2024
4.0.224 119 8/16/2024
4.0.223 126 8/14/2024
4.0.222 104 8/5/2024
4.0.221 74 8/2/2024
4.0.220 76 8/1/2024
4.0.219 82 7/31/2024
4.0.218 105 7/26/2024
4.0.217 90 7/25/2024
4.0.216 78 7/25/2024
4.0.215 107 7/11/2024
4.0.214 114 7/10/2024
4.0.213 126 7/9/2024
4.0.212 95 7/9/2024
4.0.211 111 7/9/2024
4.0.210 102 7/5/2024
4.0.209 104 7/4/2024
4.0.208 129 7/3/2024
4.0.207 104 7/2/2024
4.0.206 111 6/27/2024
4.0.205 113 6/26/2024
4.0.204 108 6/25/2024
4.0.203 107 6/24/2024
4.0.202 947 6/19/2024
4.0.201 112 6/19/2024
4.0.200 117 6/17/2024
4.0.199 113 6/14/2024
4.0.198 104 6/14/2024
4.0.197 93 6/12/2024
4.0.196 116 6/3/2024
4.0.195 106 5/31/2024
4.0.194 91 5/30/2024
4.0.193 110 5/29/2024
4.0.192 99 5/28/2024
4.0.191 104 5/27/2024
4.0.190 111 5/23/2024
4.0.189 111 5/22/2024
4.0.188 116 5/21/2024
4.0.187 123 5/20/2024
4.0.186 117 5/18/2024
4.0.185 117 5/16/2024
4.0.184 117 5/15/2024
4.0.183 108 5/8/2024
4.0.182 130 5/7/2024
4.0.181 135 5/6/2024
4.0.180 111 5/3/2024
4.0.179 640 5/2/2024
4.0.178 96 5/2/2024
4.0.177 115 5/1/2024
4.0.176 123 4/29/2024
4.0.175 108 4/29/2024
4.0.174 114 4/25/2024
4.0.173 130 4/24/2024
4.0.172 120 4/16/2024
4.0.171 115 4/15/2024
4.0.170 135 4/13/2024
4.0.169 110 4/12/2024
4.0.168 123 4/11/2024
4.0.167 120 4/10/2024
4.0.166 108 4/9/2024
4.0.165 128 4/9/2024
4.0.164 122 4/1/2024
4.0.163 119 3/29/2024
4.0.162 120 3/29/2024
4.0.161 121 3/27/2024
4.0.160 114 3/22/2024
4.0.159 122 3/22/2024
4.0.158 128 3/18/2024
4.0.157 127 3/15/2024
4.0.156 117 3/14/2024
4.0.155 123 3/14/2024
4.0.154 128 3/11/2024
4.0.153 132 3/8/2024
4.0.152 128 3/7/2024
4.0.151 137 3/6/2024
4.0.150 150 3/5/2024
4.0.149 147 3/4/2024
4.0.148 964 3/2/2024
4.0.147 138 2/29/2024
4.0.146 111 2/29/2024
4.0.145 124 2/27/2024
4.0.144 115 2/26/2024
4.0.143 116 2/23/2024
4.0.142 126 2/22/2024
4.0.141 125 2/22/2024
4.0.140 121 2/21/2024
4.0.139 126 2/20/2024
4.0.138 113 2/19/2024
4.0.137 120 2/19/2024
4.0.136 118 2/16/2024
4.0.135 115 2/16/2024
4.0.134 117 2/15/2024
4.0.133 137 2/14/2024
4.0.132 122 2/14/2024
4.0.131 124 2/13/2024
4.0.130 140 2/9/2024
4.0.129 130 2/9/2024
4.0.128 127 2/7/2024
4.0.127 117 2/6/2024
4.0.126 125 2/6/2024
4.0.125 118 2/5/2024
4.0.124 125 2/3/2024
4.0.123 129 2/1/2024
4.0.122 106 2/1/2024
4.0.121 108 1/31/2024
4.0.120 123 1/29/2024
4.0.119 113 1/25/2024
4.0.118 113 1/24/2024
4.0.117 122 1/23/2024
4.0.116 123 1/22/2024
4.0.115 1,027 1/17/2024
4.0.114 118 1/16/2024
4.0.113 115 1/15/2024
4.0.112 122 1/12/2024
4.0.111 127 1/11/2024
4.0.110 127 1/10/2024
4.0.109 316 1/8/2024
4.0.108 143 1/6/2024
4.0.107 282 12/26/2023
4.0.106 111 12/26/2023
4.0.105 117 12/26/2023
4.0.104 144 12/25/2023
4.0.103 127 12/23/2023
4.0.102 128 12/21/2023
4.0.101 142 12/15/2023
4.0.100 124 12/14/2023
4.0.99 131 12/13/2023
4.0.98 136 12/13/2023
4.0.97 471 12/12/2023
4.0.96 125 12/12/2023
4.0.95 117 12/12/2023
4.0.94 116 12/11/2023
4.0.93 203 12/6/2023
4.0.92 145 12/6/2023
4.0.91 146 12/6/2023
4.0.90 127 12/4/2023
4.0.89 281 11/24/2023
4.0.88 147 11/24/2023
4.0.87 140 11/21/2023
4.0.86 144 11/20/2023
4.0.85 124 11/20/2023
4.0.84 177 11/17/2023
4.0.83 441 11/17/2023
4.0.82 154 11/15/2023
4.0.81 143 11/13/2023
4.0.80 167 11/9/2023
4.0.79 184 11/9/2023
4.0.78 131 11/8/2023
4.0.77 143 11/7/2023
4.0.76 151 11/6/2023
4.0.75 154 11/3/2023
4.0.74 185 11/2/2023
4.0.73 158 11/1/2023
4.0.72 162 10/31/2023
4.0.71 138 10/31/2023
4.0.70 131 10/30/2023
4.0.69 168 10/28/2023
4.0.68 150 10/26/2023
4.0.67 158 10/25/2023
4.0.66 155 10/17/2023
4.0.65 145 10/16/2023
4.0.64 124 10/16/2023
4.0.63 171 10/13/2023
4.0.62 167 10/12/2023
4.0.61 159 10/11/2023
4.0.60 187 10/5/2023
4.0.59 160 10/4/2023
4.0.58 172 9/26/2023
4.0.57 155 9/26/2023
4.0.56 162 9/22/2023
4.0.55 167 9/20/2023
4.0.54 170 9/19/2023
4.0.53 165 9/18/2023
4.0.52 142 9/18/2023
4.0.51 203 9/15/2023
4.0.50 162 9/14/2023
4.0.49 164 9/12/2023
4.0.48 228 9/12/2023
4.0.47 149 9/11/2023
4.0.46 180 9/11/2023
4.0.45 275 9/7/2023
4.0.44 181 9/6/2023
4.0.43 214 9/5/2023
4.0.42 178 9/4/2023
4.0.41 160 9/4/2023
4.0.40 199 9/1/2023
4.0.39 201 8/31/2023
4.0.38 193 8/31/2023
4.0.37 196 8/29/2023
4.0.36 174 8/29/2023
4.0.35 203 8/29/2023
4.0.34 207 8/25/2023
4.0.33 193 8/24/2023
4.0.32 197 8/23/2023
4.0.31 203 8/22/2023
4.0.30 193 8/18/2023
4.0.29 181 8/17/2023
4.0.28 208 8/17/2023
4.0.27 161 8/17/2023
4.0.26 277 8/10/2023
4.0.25 204 8/9/2023
4.0.24 215 8/8/2023
4.0.23 186 8/8/2023
4.0.22 172 8/8/2023
4.0.21 298 8/7/2023
4.0.20 202 8/4/2023
4.0.19 254 8/3/2023
4.0.18 205 8/2/2023
4.0.17 236 7/26/2023
4.0.16 227 7/25/2023
4.0.15 236 7/21/2023
4.0.14 198 7/19/2023
4.0.13 196 7/18/2023
4.0.12 172 7/18/2023
4.0.11 227 7/18/2023
4.0.10 174 7/18/2023
4.0.9 272 7/17/2023
4.0.8 185 7/17/2023
4.0.7 173 7/17/2023
4.0.6 178 7/17/2023
4.0.5 491 1/30/2023
4.0.4 276 1/30/2023
4.0.3 376 1/30/2023
4.0.2 382 1/27/2023
4.0.1 558 12/13/2022
4.0.0 318 12/12/2022
3.0.43 1,507 6/10/2022
3.0.41 941 4/20/2022
3.0.40 979 1/11/2022
3.0.39 761 1/10/2022
3.0.38 1,029 6/17/2021
3.0.37 751 6/16/2021
3.0.36 696 6/16/2021
3.0.35 481 6/16/2021
3.0.34 460 6/16/2021
3.0.33 926 1/7/2021
3.0.32 761 12/16/2020
3.0.31 704 12/14/2020
3.0.29 2,294 9/13/2020
3.0.28 846 6/19/2020
3.0.27 851 6/8/2020
3.0.26 1,602 5/12/2020
3.0.25 1,367 5/12/2020
3.0.24 841 4/28/2020
3.0.23 847 4/24/2020
3.0.22 847 4/16/2020
3.0.21 852 4/16/2020
3.0.20 579 4/15/2020
3.0.19 562 4/15/2020
3.0.18 1,105 4/14/2020
3.0.17 557 4/14/2020
3.0.16 898 4/10/2020
3.0.15 925 4/10/2020
3.0.14 3,019 3/26/2020
3.0.13 837 3/26/2020
3.0.12 584 3/25/2020
3.0.11 566 3/25/2020
3.0.10 557 3/25/2020
3.0.9 598 3/25/2020
3.0.8 589 3/25/2020
3.0.7 1,080 3/25/2020
3.0.6 1,251 3/21/2020
3.0.5 1,590 3/13/2020
3.0.4 622 3/13/2020
3.0.3 1,315 2/28/2020
3.0.2 1,135 2/21/2020
3.0.1 634 2/11/2020
3.0.0 1,810 12/23/2019
2.0.10 1,037 4/17/2019
2.0.9 1,558 2/21/2019
2.0.8 734 2/21/2019
2.0.7 3,846 8/1/2018
2.0.6 1,206 8/1/2018
2.0.5 1,513 6/26/2018
2.0.4 1,604 6/1/2018
2.0.3 1,560 5/22/2018
2.0.2 2,115 5/11/2018
2.0.1 2,188 2/13/2018
2.0.0 2,097 1/2/2018
1.0.10 13,929 6/16/2017
1.0.8 1,052 6/16/2017
1.0.7 1,016 5/30/2017
1.0.6 991 5/30/2017
1.0.5 1,004 5/25/2017
1.0.4 1,023 5/24/2017
1.0.0 1,045 5/24/2017