Giter VIP home page Giter VIP logo

nhibernateminiprofilermysql's Introduction

NHibernate MySQL MiniProfiler driver

Build status

The MiniProfiler library allows you to easily profile your application. It also has support for database profiles, but out of the box only Entity Framework and ADO.NET are supported. This leaves out NHibernate. This project shows how to allow allow MiniProfiler to also integrate with NHibernate. The project includes a client driver for MySQL, but it is easy to modify this code to support any client NHibernate supports.

Implementation

As this library is meant to connect NHibernate with the MiniProfiler, you first have to have a project that references both libraries. You can install them using NuGet as follows:

Install-Package NHibernate
Install-Package MiniProfiler 

Then you need to include this project in your project. You can choose between two paths:

  1. You compile the NHibernate.MiniProfiler.MySql and reference the built DLL from your project
  2. You include the ProfiledMySqlClientDriver file in your project.

After you have finished these steps, you need to do just one more thing: let NHibernate know it should use our custom ProfiledMySqlClientDriver as the driver for MySQL connections. You can do this by setting the Driver property of the Configuration instance you are using. This can look something like this:

var mySqlConfiguration = new Configuration();
mySqlConfiguration.DataBaseIntegration(c =>
    {
        c.Dialect<NHibernate.Dialect.MySQL5Dialect>();
        c.Driver<ProfiledMySqlClientDriver>();
        c.ConnectionStringName = this.ConnectionStringName;
    });

And you are ready to go! Any MySQL queries executed by NHibernate will now automatically be profiled by the MiniProfiler.

License

Apache License 2.0

nhibernateminiprofilermysql's People

Contributors

erikschierboom avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.