This is part 2 of a tutorial on writing a new Orchard module from scratch.
For an overview of the tutorial, please see the introduction.
When building modules for Orchard, it is recommended to download the complete source, so let's do just that from the homepage: http://orchardproject.net/
After having downloaded the source, you may want to unblock the zip file before extracting its content:
Next, unzip the file and open the Orchard.sln file with Visual Studio 2010:
From within Visual Studio, press CTRL + F5 to launch the website. Since there is no database configured yet, Orchard will display the following setup page:
You have the option of working with SQL Server Express or SQL Server Compact.
SQL CE is perfectly fine for development purposes and low-traffic websites, but for websites that require better performance (and most websites do) you should use SQL Server / SQL Server Express.
For this tutorial we will show how to use SQL Server Express.
When choosing SQL Server Express, make sure that you first create a database named "OrchardWebshopDemo", otherwise you will see the following error:
I am using Microsoft SQL Server Management Studio Express to create a new empty database:
The connection string for my pc is: "Data Source=.\sqlexpress;Initial Catalog=OrchardWebshopDemo;Persist Security Info=True;Integrated Security=True;"
We are also given the option to provide a database table prefix. The prefix we enter here will be used to prefix all of the tables that Orchard generates. This is useful when you would creating multiple tenants and at the same time you want them to use the same database. We won't be using multiple tenants in this tutorial, so you can leave this field empty.
Lastly, the setup page asks us to choose an Orchard Recipe. A Recipe is basically an XML file that contains instructions for Orchard on which content types to create, what default data to insert, which modules to install and what features to enable, and even what Orchard commands to execute. Orchard allows us to create new recipes ourselves. This tutorial won't go into more details on this, but you can find more information and instructions here.
For our purposes, the Default recipe is fine.
After pressing the Finish button, Orchard cooks the selected Recipe and if everything went OK you should see a brand new homepage using the default ThemeMachine theme:
Now that we have a running Orchard installation, let's get started and create the Webshop module!
Part 3: Creating the Orchard.Webshop Module Project