Holmes 4.0.232

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

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

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
4.0.244 84 9/17/2024
4.0.243 73 9/16/2024
4.0.242 79 9/10/2024
4.0.241 66 9/9/2024
4.0.240 67 9/6/2024
4.0.239 67 9/6/2024
4.0.238 79 9/3/2024
4.0.237 72 9/2/2024
4.0.236 79 8/30/2024
4.0.235 81 8/30/2024
4.0.234 75 8/28/2024
4.0.233 89 8/27/2024
4.0.232 77 8/26/2024
4.0.231 102 8/24/2024
4.0.230 104 8/23/2024
4.0.229 107 8/21/2024
4.0.228 99 8/21/2024
4.0.227 98 8/20/2024
4.0.226 91 8/19/2024
4.0.225 98 8/16/2024
4.0.224 94 8/16/2024
4.0.223 103 8/14/2024
4.0.222 80 8/5/2024
4.0.221 52 8/2/2024
4.0.220 53 8/1/2024
4.0.219 56 7/31/2024
4.0.218 81 7/26/2024
4.0.217 70 7/25/2024
4.0.216 69 7/25/2024
4.0.215 87 7/11/2024
4.0.214 80 7/10/2024
4.0.213 87 7/9/2024
4.0.212 75 7/9/2024
4.0.211 92 7/9/2024
4.0.210 82 7/5/2024
4.0.209 83 7/4/2024
4.0.208 105 7/3/2024
4.0.207 98 7/2/2024
4.0.206 93 6/27/2024
4.0.205 93 6/26/2024
4.0.204 89 6/25/2024
4.0.203 87 6/24/2024
4.0.202 618 6/19/2024
4.0.201 91 6/19/2024
4.0.200 97 6/17/2024
4.0.199 94 6/14/2024
4.0.198 82 6/14/2024
4.0.197 75 6/12/2024
4.0.196 96 6/3/2024
4.0.195 86 5/31/2024
4.0.194 74 5/30/2024
4.0.193 90 5/29/2024
4.0.192 80 5/28/2024
4.0.191 82 5/27/2024
4.0.190 91 5/23/2024
4.0.189 87 5/22/2024
4.0.188 98 5/21/2024
4.0.187 102 5/20/2024
4.0.186 97 5/18/2024
4.0.185 95 5/16/2024
4.0.184 98 5/15/2024
4.0.183 90 5/8/2024
4.0.182 110 5/7/2024
4.0.181 110 5/6/2024
4.0.180 88 5/3/2024
4.0.179 530 5/2/2024
4.0.178 71 5/2/2024
4.0.177 96 5/1/2024
4.0.176 102 4/29/2024
4.0.175 89 4/29/2024
4.0.174 95 4/25/2024
4.0.173 104 4/24/2024
4.0.172 97 4/16/2024
4.0.171 84 4/15/2024
4.0.170 113 4/13/2024
4.0.169 88 4/12/2024
4.0.168 102 4/11/2024
4.0.167 92 4/10/2024
4.0.166 84 4/9/2024
4.0.165 103 4/9/2024
4.0.164 98 4/1/2024
4.0.163 97 3/29/2024
4.0.162 99 3/29/2024
4.0.161 100 3/27/2024
4.0.160 94 3/22/2024
4.0.159 97 3/22/2024
4.0.158 105 3/18/2024
4.0.157 104 3/15/2024
4.0.156 97 3/14/2024
4.0.155 93 3/14/2024
4.0.154 107 3/11/2024
4.0.153 109 3/8/2024
4.0.152 108 3/7/2024
4.0.151 111 3/6/2024
4.0.150 131 3/5/2024
4.0.149 119 3/4/2024
4.0.148 806 3/2/2024
4.0.147 119 2/29/2024
4.0.146 88 2/29/2024
4.0.145 101 2/27/2024
4.0.144 96 2/26/2024
4.0.143 94 2/23/2024
4.0.142 104 2/22/2024
4.0.141 103 2/22/2024
4.0.140 103 2/21/2024
4.0.139 104 2/20/2024
4.0.138 92 2/19/2024
4.0.137 95 2/19/2024
4.0.136 97 2/16/2024
4.0.135 94 2/16/2024
4.0.134 99 2/15/2024
4.0.133 110 2/14/2024
4.0.132 96 2/14/2024
4.0.131 102 2/13/2024
4.0.130 118 2/9/2024
4.0.129 109 2/9/2024
4.0.128 102 2/7/2024
4.0.127 93 2/6/2024
4.0.126 91 2/6/2024
4.0.125 93 2/5/2024
4.0.124 103 2/3/2024
4.0.123 97 2/1/2024
4.0.122 84 2/1/2024
4.0.121 87 1/31/2024
4.0.120 95 1/29/2024
4.0.119 92 1/25/2024
4.0.118 90 1/24/2024
4.0.117 95 1/23/2024
4.0.116 100 1/22/2024
4.0.115 836 1/17/2024
4.0.114 99 1/16/2024
4.0.113 88 1/15/2024
4.0.112 103 1/12/2024
4.0.111 102 1/11/2024
4.0.110 107 1/10/2024
4.0.109 259 1/8/2024
4.0.108 119 1/6/2024
4.0.107 236 12/26/2023
4.0.106 87 12/26/2023
4.0.105 110 12/26/2023
4.0.104 121 12/25/2023
4.0.103 107 12/23/2023
4.0.102 105 12/21/2023
4.0.101 121 12/15/2023
4.0.100 114 12/14/2023
4.0.99 107 12/13/2023
4.0.98 113 12/13/2023
4.0.97 391 12/12/2023
4.0.96 106 12/12/2023
4.0.95 109 12/12/2023
4.0.94 97 12/11/2023
4.0.93 178 12/6/2023
4.0.92 123 12/6/2023
4.0.91 127 12/6/2023
4.0.90 107 12/4/2023
4.0.89 226 11/24/2023
4.0.88 122 11/24/2023
4.0.87 114 11/21/2023
4.0.86 118 11/20/2023
4.0.85 104 11/20/2023
4.0.84 145 11/17/2023
4.0.83 366 11/17/2023
4.0.82 124 11/15/2023
4.0.81 117 11/13/2023
4.0.80 131 11/9/2023
4.0.79 148 11/9/2023
4.0.78 106 11/8/2023
4.0.77 117 11/7/2023
4.0.76 116 11/6/2023
4.0.75 123 11/3/2023
4.0.74 146 11/2/2023
4.0.73 131 11/1/2023
4.0.72 131 10/31/2023
4.0.71 119 10/31/2023
4.0.70 115 10/30/2023
4.0.69 135 10/28/2023
4.0.68 127 10/26/2023
4.0.67 130 10/25/2023
4.0.66 129 10/17/2023
4.0.65 124 10/16/2023
4.0.64 104 10/16/2023
4.0.63 143 10/13/2023
4.0.62 139 10/12/2023
4.0.61 133 10/11/2023
4.0.60 156 10/5/2023
4.0.59 144 10/4/2023
4.0.58 138 9/26/2023
4.0.57 130 9/26/2023
4.0.56 134 9/22/2023
4.0.55 141 9/20/2023
4.0.54 142 9/19/2023
4.0.53 139 9/18/2023
4.0.52 121 9/18/2023
4.0.51 165 9/15/2023
4.0.50 137 9/14/2023
4.0.49 136 9/12/2023
4.0.48 203 9/12/2023
4.0.47 129 9/11/2023
4.0.46 147 9/11/2023
4.0.45 240 9/7/2023
4.0.44 166 9/6/2023
4.0.43 182 9/5/2023
4.0.42 153 9/4/2023
4.0.41 131 9/4/2023
4.0.40 166 9/1/2023
4.0.39 169 8/31/2023
4.0.38 161 8/31/2023
4.0.37 169 8/29/2023
4.0.36 153 8/29/2023
4.0.35 170 8/29/2023
4.0.34 181 8/25/2023
4.0.33 173 8/24/2023
4.0.32 169 8/23/2023
4.0.31 176 8/22/2023
4.0.30 159 8/18/2023
4.0.29 155 8/17/2023
4.0.28 162 8/17/2023
4.0.27 139 8/17/2023
4.0.26 232 8/10/2023
4.0.25 177 8/9/2023
4.0.24 189 8/8/2023
4.0.23 165 8/8/2023
4.0.22 147 8/8/2023
4.0.21 262 8/7/2023
4.0.20 176 8/4/2023
4.0.19 229 8/3/2023
4.0.18 171 8/2/2023
4.0.17 203 7/26/2023
4.0.16 200 7/25/2023
4.0.15 209 7/21/2023
4.0.14 172 7/19/2023
4.0.13 170 7/18/2023
4.0.12 153 7/18/2023
4.0.11 192 7/18/2023
4.0.10 148 7/18/2023
4.0.9 224 7/17/2023
4.0.8 166 7/17/2023
4.0.7 154 7/17/2023
4.0.6 159 7/17/2023
4.0.5 452 1/30/2023
4.0.4 258 1/30/2023
4.0.3 360 1/30/2023
4.0.2 345 1/27/2023
4.0.1 528 12/13/2022
4.0.0 297 12/12/2022
3.0.43 1,466 6/10/2022
3.0.41 909 4/20/2022
3.0.40 940 1/11/2022
3.0.39 730 1/10/2022
3.0.38 979 6/17/2021
3.0.37 715 6/16/2021
3.0.36 659 6/16/2021
3.0.35 454 6/16/2021
3.0.34 437 6/16/2021
3.0.33 885 1/7/2021
3.0.32 721 12/16/2020
3.0.31 681 12/14/2020
3.0.29 2,197 9/13/2020
3.0.28 808 6/19/2020
3.0.27 814 6/8/2020
3.0.26 1,537 5/12/2020
3.0.25 1,307 5/12/2020
3.0.24 819 4/28/2020
3.0.23 826 4/24/2020
3.0.22 799 4/16/2020
3.0.21 811 4/16/2020
3.0.20 558 4/15/2020
3.0.19 535 4/15/2020
3.0.18 1,063 4/14/2020
3.0.17 536 4/14/2020
3.0.16 856 4/10/2020
3.0.15 889 4/10/2020
3.0.14 2,922 3/26/2020
3.0.13 815 3/26/2020
3.0.12 560 3/25/2020
3.0.11 543 3/25/2020
3.0.10 534 3/25/2020
3.0.9 569 3/25/2020
3.0.8 564 3/25/2020
3.0.7 1,042 3/25/2020
3.0.6 1,211 3/21/2020
3.0.5 1,534 3/13/2020
3.0.4 594 3/13/2020
3.0.3 1,264 2/28/2020
3.0.2 1,084 2/21/2020
3.0.1 612 2/11/2020
3.0.0 1,736 12/23/2019
2.0.10 1,014 4/17/2019
2.0.9 1,503 2/21/2019
2.0.8 710 2/21/2019
2.0.7 3,738 8/1/2018
2.0.6 1,162 8/1/2018
2.0.5 1,480 6/26/2018
2.0.4 1,558 6/1/2018
2.0.3 1,532 5/22/2018
2.0.2 2,067 5/11/2018
2.0.1 2,123 2/13/2018
2.0.0 2,032 1/2/2018
1.0.10 13,545 6/16/2017
1.0.8 1,018 6/16/2017
1.0.7 991 5/30/2017
1.0.6 968 5/30/2017
1.0.5 966 5/25/2017
1.0.4 998 5/24/2017
1.0.0 989 5/24/2017