Important: You need to set this XML file’s Copy to output directory option to “Copy Always”, or your application will burst into flames almost immediately.Ĭreating the Entity Class and the Mapping If you set that one to true, all SQL-Queries generated by NHibernate will be written to the console, which is very useful for debugging. First, there is the Data Source in the property nnection_string which specifies which database file will be used (the files is created automatically if it does not exist). 20Driver Data Source=nhibernate.db Version=3 true=1 false=0 true NHibernate (installs Iesi.Collections as a dependency)Ĭreate a new XML file called in your project’s root directory (Right click on your project > Add > New Item, then from the left menu choose “Data” and then “XML File”), and insert the following content:. ![]() Now install the following libraries (if you can’t find them, there’s a search field in the upper right corner): If you don’t have that menu option make sure you’ve restarted Visual Studio after installing NuGet. Now, in the main Visual Studio window, go to “Tools > Library Package Manager > Manage NuGet Packages”. ![]() Setting up your projectįor this tutorial, I created a Visual C# Console Application called “NHExample”, and I suggest you do the same (including the name, because I will be using it later in the example files): Download NuGet from the project’s homepage and follow the installation instructions. The problem was that I tried to set up the libraries all by myself, when there is this awesome tool called NuGet which does it for you. Here’s something that really took me some time to figure out.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |