Holmes 4.0.174

dotnet add package Holmes --version 4.0.174
NuGet\Install-Package Holmes -Version 4.0.174
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.174" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Holmes --version 4.0.174
#r "nuget: Holmes, 4.0.174"
#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.174

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

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.174 0 4/25/2024
4.0.173 49 4/24/2024
4.0.172 84 4/16/2024
4.0.171 71 4/15/2024
4.0.170 94 4/13/2024
4.0.169 78 4/12/2024
4.0.168 84 4/11/2024
4.0.167 80 4/10/2024
4.0.166 72 4/9/2024
4.0.165 86 4/9/2024
4.0.164 86 4/1/2024
4.0.163 85 3/29/2024
4.0.162 86 3/29/2024
4.0.161 88 3/27/2024
4.0.160 83 3/22/2024
4.0.159 86 3/22/2024
4.0.158 88 3/18/2024
4.0.157 92 3/15/2024
4.0.156 83 3/14/2024
4.0.155 81 3/14/2024
4.0.154 92 3/11/2024
4.0.153 95 3/8/2024
4.0.152 94 3/7/2024
4.0.151 93 3/6/2024
4.0.150 109 3/5/2024
4.0.149 97 3/4/2024
4.0.148 600 3/2/2024
4.0.147 93 2/29/2024
4.0.146 79 2/29/2024
4.0.145 92 2/27/2024
4.0.144 85 2/26/2024
4.0.143 82 2/23/2024
4.0.142 92 2/22/2024
4.0.141 85 2/22/2024
4.0.140 91 2/21/2024
4.0.139 93 2/20/2024
4.0.138 81 2/19/2024
4.0.137 85 2/19/2024
4.0.136 85 2/16/2024
4.0.135 83 2/16/2024
4.0.134 82 2/15/2024
4.0.133 99 2/14/2024
4.0.132 85 2/14/2024
4.0.131 92 2/13/2024
4.0.130 103 2/9/2024
4.0.129 88 2/9/2024
4.0.128 84 2/7/2024
4.0.127 80 2/6/2024
4.0.126 80 2/6/2024
4.0.125 80 2/5/2024
4.0.124 85 2/3/2024
4.0.123 83 2/1/2024
4.0.122 74 2/1/2024
4.0.121 77 1/31/2024
4.0.120 85 1/29/2024
4.0.119 82 1/25/2024
4.0.118 79 1/24/2024
4.0.117 78 1/23/2024
4.0.116 83 1/22/2024
4.0.115 799 1/17/2024
4.0.114 84 1/16/2024
4.0.113 78 1/15/2024
4.0.112 91 1/12/2024
4.0.111 87 1/11/2024
4.0.110 97 1/10/2024
4.0.109 246 1/8/2024
4.0.108 105 1/6/2024
4.0.107 217 12/26/2023
4.0.106 77 12/26/2023
4.0.105 101 12/26/2023
4.0.104 113 12/25/2023
4.0.103 99 12/23/2023
4.0.102 98 12/21/2023
4.0.101 114 12/15/2023
4.0.100 106 12/14/2023
4.0.99 100 12/13/2023
4.0.98 99 12/13/2023
4.0.97 359 12/12/2023
4.0.96 91 12/12/2023
4.0.95 100 12/12/2023
4.0.94 88 12/11/2023
4.0.93 160 12/6/2023
4.0.92 109 12/6/2023
4.0.91 112 12/6/2023
4.0.90 99 12/4/2023
4.0.89 216 11/24/2023
4.0.88 113 11/24/2023
4.0.87 105 11/21/2023
4.0.86 110 11/20/2023
4.0.85 95 11/20/2023
4.0.84 128 11/17/2023
4.0.83 264 11/17/2023
4.0.82 115 11/15/2023
4.0.81 106 11/13/2023
4.0.80 113 11/9/2023
4.0.79 132 11/9/2023
4.0.78 90 11/8/2023
4.0.77 101 11/7/2023
4.0.76 106 11/6/2023
4.0.75 107 11/3/2023
4.0.74 136 11/2/2023
4.0.73 118 11/1/2023
4.0.72 120 10/31/2023
4.0.71 103 10/31/2023
4.0.70 105 10/30/2023
4.0.69 125 10/28/2023
4.0.68 117 10/26/2023
4.0.67 114 10/25/2023
4.0.66 119 10/17/2023
4.0.65 108 10/16/2023
4.0.64 93 10/16/2023
4.0.63 127 10/13/2023
4.0.62 128 10/12/2023
4.0.61 117 10/11/2023
4.0.60 139 10/5/2023
4.0.59 132 10/4/2023
4.0.58 127 9/26/2023
4.0.57 120 9/26/2023
4.0.56 125 9/22/2023
4.0.55 125 9/20/2023
4.0.54 127 9/19/2023
4.0.53 124 9/18/2023
4.0.52 112 9/18/2023
4.0.51 155 9/15/2023
4.0.50 127 9/14/2023
4.0.49 126 9/12/2023
4.0.48 186 9/12/2023
4.0.47 119 9/11/2023
4.0.46 138 9/11/2023
4.0.45 231 9/7/2023
4.0.44 157 9/6/2023
4.0.43 172 9/5/2023
4.0.42 143 9/4/2023
4.0.41 121 9/4/2023
4.0.40 157 9/1/2023
4.0.39 158 8/31/2023
4.0.38 153 8/31/2023
4.0.37 160 8/29/2023
4.0.36 139 8/29/2023
4.0.35 163 8/29/2023
4.0.34 167 8/25/2023
4.0.33 165 8/24/2023
4.0.32 161 8/23/2023
4.0.31 169 8/22/2023
4.0.30 145 8/18/2023
4.0.29 148 8/17/2023
4.0.28 154 8/17/2023
4.0.27 131 8/17/2023
4.0.26 218 8/10/2023
4.0.25 170 8/9/2023
4.0.24 176 8/8/2023
4.0.23 158 8/8/2023
4.0.22 139 8/8/2023
4.0.21 248 8/7/2023
4.0.20 168 8/4/2023
4.0.19 221 8/3/2023
4.0.18 163 8/2/2023
4.0.17 192 7/26/2023
4.0.16 186 7/25/2023
4.0.15 201 7/21/2023
4.0.14 164 7/19/2023
4.0.13 161 7/18/2023
4.0.12 139 7/18/2023
4.0.11 178 7/18/2023
4.0.10 140 7/18/2023
4.0.9 216 7/17/2023
4.0.8 160 7/17/2023
4.0.7 147 7/17/2023
4.0.6 153 7/17/2023
4.0.5 441 1/30/2023
4.0.4 249 1/30/2023
4.0.3 351 1/30/2023
4.0.2 336 1/27/2023
4.0.1 516 12/13/2022
4.0.0 288 12/12/2022
3.0.43 1,458 6/10/2022
3.0.41 902 4/20/2022
3.0.40 934 1/11/2022
3.0.39 719 1/10/2022
3.0.38 972 6/17/2021
3.0.37 709 6/16/2021
3.0.36 653 6/16/2021
3.0.35 442 6/16/2021
3.0.34 431 6/16/2021
3.0.33 878 1/7/2021
3.0.32 713 12/16/2020
3.0.31 673 12/14/2020
3.0.29 2,188 9/13/2020
3.0.28 801 6/19/2020
3.0.27 807 6/8/2020
3.0.26 1,530 5/12/2020
3.0.25 1,302 5/12/2020
3.0.24 813 4/28/2020
3.0.23 821 4/24/2020
3.0.22 787 4/16/2020
3.0.21 805 4/16/2020
3.0.20 553 4/15/2020
3.0.19 529 4/15/2020
3.0.18 1,057 4/14/2020
3.0.17 530 4/14/2020
3.0.16 846 4/10/2020
3.0.15 884 4/10/2020
3.0.14 2,913 3/26/2020
3.0.13 808 3/26/2020
3.0.12 555 3/25/2020
3.0.11 538 3/25/2020
3.0.10 526 3/25/2020
3.0.9 564 3/25/2020
3.0.8 552 3/25/2020
3.0.7 1,035 3/25/2020
3.0.6 1,204 3/21/2020
3.0.5 1,529 3/13/2020
3.0.4 581 3/13/2020
3.0.3 1,259 2/28/2020
3.0.2 1,079 2/21/2020
3.0.1 608 2/11/2020
3.0.0 1,730 12/23/2019
2.0.10 1,007 4/17/2019
2.0.9 1,496 2/21/2019
2.0.8 696 2/21/2019
2.0.7 3,730 8/1/2018
2.0.6 1,155 8/1/2018
2.0.5 1,474 6/26/2018
2.0.4 1,552 6/1/2018
2.0.3 1,520 5/22/2018
2.0.2 2,061 5/11/2018
2.0.1 2,117 2/13/2018
2.0.0 2,025 1/2/2018
1.0.10 13,535 6/16/2017
1.0.8 1,013 6/16/2017
1.0.7 985 5/30/2017
1.0.6 963 5/30/2017
1.0.5 960 5/25/2017
1.0.4 993 5/24/2017
1.0.0 978 5/24/2017