The development setup

In order to learn NHibernate most effectively, it is important that you follow the concepts and code samples from this book and try them yourself. While the code from this book should work on any general development environment, it would be prudent to mention which tools I am going to use in particular. If any of the code samples from this book does not work for you, you can always confirm first if it is due to tooling incompatibility. There are a couple of optional tools that I will be referring to in some chapters. These tools help working with NHibernate but are not necessary as there are alternatives available. These tools are not listed here. I will introduce them when they are referred to for the first time in this book.

So, here is the list of tools that we will use:

Visual Studio 2013

I will primarily be using Visual Studio as my code editor. I will be using VS 2013, which is the latest version of Visual Studio at the time of writing of this book. Lately, Visual Studio has had both backward and forward compatibility. This means that you can open a Visual Studio 2013 solution in Visual Studio 2012 and vice versa. So, even if you are on a slightly older or possibly a newer version of Visual Studio, things should work just fine.

SQL Server 2012 Express

We will be using the free Express version of SQL Server 2012. The latest version of SQL Server is 2014. However, the latest stable version of NHibernate officially supports SQL Server versions only till 2012. This does not mean that NHibernate will not support SQL Server 2014. Everything except the newly added features of SQL Server 2014 will work just fine. You can download SQL Server 2012 Express from here: http://www.microsoft.com/en-gb/download/details.aspx?id=29062.

Note that the SQL Server download page has multiple downloads available. You can choose the right one for your hardware and operating system by going through the details on the same page.

ReSharper

ReSharper is a code inspection and refactoring tool that fully integrates with Visual Studio. ReSharper makes it very easy to add new code, refactor the existing code, and so on, and increases your productivity greatly. Although ReSharper has no role to play in learning NHibernate, I think that it is worth mentioning as I have used it extensively while preparing the samples for the book. ReSharper is a paid tool, but you can download a free trial version from here: https://www.jetbrains.com/resharper/download/.

NUnit

We will use NUnit to write our unit tests. There are two ways of running the unit tests. If you have ReSharper or a similar code refactoring tool available, then you can run your NUnit tests right from within Visual Studio. For others, you can use the NUnit GUI runner. The NUnit GUI runner is a Windows application that does not integrate with Visual Studio but is capable of detecting and running unit tests from loaded assemblies. I will be using ReSharper to run the tests as it is the most productive in my experience.

You can download NUnit GUI runner from here: http://www.nunit.org/index.php?p=download.

NuGet

In order to use NHibernate and any other dependent libraries, we will use NuGet. NuGet is a package manager for .NET. Think of NuGet as a repository of the third-party packages and libraries that you would like to reference in your project. NuGet makes it very easy to add new libraries to a project, manage versions of the references libraries, and so on. The latest version of Visual Studio supports NuGet out of the box and there is no configuration that you need to change to enable NuGet. For older versions, you would need to install the NuGet extension. Instructions for installing the NuGet extension can be found here: https://docs.nuget.org/consume/installing-nuget.

SQLite

SQLite is a lightweight relational database that we are going to use during our unit tests. If I can quote the SQLite website here, then here is what it says about SQLite:

"SQLite is a software library that implements a self-contained, serverless, zero-configuration, transactional SQL database engine."

So, as the website says, SQLite is self-contained, meaning minimal or no dependency on external libraries. It is also serverless, so it does not require a server that needs to be running all the time in order to serve our data requests. It absolutely does not require any configuration for the setup. You just add a reference to a DLL and that is it. Further, most importantly, it is a transactional and relational database engine that supports SQL. These attributes along with its ability to run in the in-memory mode make it suitable for use within unit tests.

However, you have to remember that this is a light implementation of a relational database, so it does not support all features of an SQL server. However, it does support the most commonly used features. For what it does not support, there are workarounds available that we are going to look into as we encounter them.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
52.15.56.12