Getting Started (Part 1 of 6)
This tutorial is part of a series which goal is to build an application on top of the AdventureWorks2008 Light database.
This part will walk you through the following steps:
- Installing Vidyano
- Setting up the AdventureWorks2008 Light database on Microsoft SQL Server 2008 Express
- Creating a new Vidyano Project
- Creating a LINQ to SQL Model on AdventureWorks
- Creating a Vidyano Module
- Adding a page to the Vidyano Module
- Binding the data
- Setting the connection string
- Launching the application
Installing Vidyano
If you’ve downloaded Vidyano, all you need to do is launch the MSI installer by double-clicking it. There are no specific steps during the setup that need additional explaining. Just hit Next until you hit the Finish page. That’s it!
Setting up the AdventureWorks2008 Light database on Microsoft SQL Server 2008 Express
Before we dive into the nuts and bolts of creating a Vidyano application, we will first set up the AdventureWorks 2008 Light database. You can download the database file from the Vidyano download page [1]. We assume that you have installed Microsoft SQL Server 2008 Express on your local machine, if not, please refer to the references section at the end of this document on how to do this [2].
Perform the following steps to set up the database:
- Launch Microsoft SQL Server Management Studio 2008.
- Connect to your local server by entering .\SQLEXPRESS as server name and click Connect.
- In the Object Explorer, right-click the Databases node and select Attach.
- Click Add and browse to the location where you extracted the database files.
- Select the AdventureWorksLT2008_Data.mdf file and click OK.
- Verify that AdventureWorksLT2008 is listed under the Databases node.
- Exit Microsoft SQL Server Management Studio 2008.
Creating a new Vidyano Project
- Launch Microsoft Visual Studio and select File -> New -> Project from the main menu.
- In the Add New Project dialog, select Vidyano, choose the VidyanoProject template, and name it AdventureWorksDemo. Optionally select a different location. Click OK.
- In the New Project wizard dialog, type AdventureWorks Demo where it says Application Title. Leave all other settings as default. Click Finish.
The following project structure will be created for you.
Figure 2 : Vidyano New Project Dialog
Creating a LINQ to SQL Model on AdventureWorks
Let’s add a LINQ to SQL model to our model project, which we can use as data layer for our Vidyano modules later on.
- In Visual Studio, right-click the AdventureWorksDemo.Model project.
- Select Add -> New Item.
- In the Add New Item dialog, select Data and choose the LINQ to SQL classes template.
- Enter AdventureWorks.dbml as filename and click Add.
From the Server Explorer in Visual Studio, perform the following steps:
- Right-click Data Connections and select Add Connection.
- Make sure the Data source says Microsoft SQL Server (SqlClient). If not, then click the Change button and select it from the list.
- Type .\SQLEXPRESS where it says Server name. Select Use Windows Authentication.
- Select the AdventureWorksLT2008 database from the list and click OK.
- Expand the new data connection, and it’s Tables node. Select all tables, except BuildVersion and ErrorLog, and drag them on the LINQ to SQL design surface.
Note: Visual Studio automatically adds a new app.config and Settings.settings file to your project. You may delete these from your project as we are going to enter our connection string in a different location. If you delete these files you also need to clear the connection property. To do this, click somewhere on the design surface of your LINQ to SQL file so that the properties panel shows all properties of the AdventureWorksDataContext. Set the Connection property to (None).
Create a Vidyano Module
- Right-click the AdventureWorksDemo.Module project in your solution and choose Add -> Vidyano Module.
- Set the name to Customers.mod
- In the Add Module dialog you can select which Model will be used for this Module. Select the AdventureWorksDataContext model and click Finish.
Adding a page to the Vidyano Module
The Customers designer should now be visible in Visual Studio (if not, double-click the Customers.mod file in the project). We are going to add a page which will list all customers.
Figure 7 : Vidyano Module Designer
- On the left side of the Module Designer, click Pages, then click the + button. The Add New Page wizard will be launched.
- In the Add New Page dialog, enter Overview as the name for our new page. Leave all other settings as default. Click Next.
- Select the top-left layout (Empty) for this page, which is just a single part layout. Click Finish.
Figure 8 : Add New Page Dialog
Binding the data
On the page designer, we can select what data needs to be shown. There is only one part on this page (PART_1). Perform the following steps to make it show the list of Customers.
- Click the button “1” in the center of PART_1.
- From the Add Part for PART_1 dialog, select the ListView (Grid) control.
- Select the Customer entity and choose the Module.Context.Customers binding. This will query the customers directly from the database.
- Select the following properties and add them to the list on the right-side by double-clicking the property or clicking the > button after having them selected: Title, FirstName, MiddleName, LastName and CompanyName. (Note: You can change the order by dragging the properties in the right-side list)
- Click Next. Figure 12 : Select entity and binding
Figure 10 : Vidyano Page Designer
Figure 11 : Selecting a control type for a Part
Setting the connection string
- In the Solution Explorer, double-click the Application.app file in the AdventureWorksDemo.
- On the left, click Configurations.
- Next to the Default ConnectionString, click the browse (...) button.
- From the Choose Data Source dialog, select Microsoft SQL Server.
- Type .\SQLEXPRESS where it says Server name. Select Use Windows Authentication.
- Select the AdventureWorksLT2008 database from the list and click OK.
Figure 13 : Setting the ConnectionString
Launching the application
- Run the application by pressing CTRL+F5 or the Play button on the toolbar.
- In the application, click the Customers module on the bottom-left.

