Well it is time to start creating the application. After the problems detailed in the last post we will not currently be using the Azure Tools.
That said there are a few things we need to download.
Visual Studio 2010 (http://msdn.microsoft.com/en-us/vstudio/dd582936.aspx)
WCF RIA Services (http://silverlight.net/getstarted/riaservices/)
Install both of those.
Start Visual Studio 2010
Select File, New Project – in the list of Installed Templates to the left, select the Silverlight option. to use the WCF RIA Services DomainService template we need to make sure .Net Framework 4 is selected in the .Net Framework pulldown. If it is not selected then the WCF RIA Services Class Library is not listed and this is required later to provide the Middle and Back-end tiers of the app.
When you do this you will find a number of templates – some of which are new to Silverlight development.
- Silverlight Application
- Silverlight Business Application
- Silverlight Class Application
- Silverlight Navigation Application
- Silverlight Unit Test Application
- WCF RIA Services Class Library
I’m not doing to use them but the Business Appliction and Navigation Applicaton deserve some consideration. One of the latest additions is the ability to allow the user to use the Back button of the browser in Navigating the application. This is achieved by using the Navigation Application template and it provides a way of allowing different pages of an application to be created and navigated around.
The Business Application is the virtually the same but in addition to a Silverlight application it also includes a WCF RIA Services Class to provide the database backend. On the face of it this would seem the ideal candidate for my application. However my app is a single page with drag and drop functionality – I really don’t want extras in the app that are not required. For this reason I am going to create my Silverlight Application from scratch and set up the reference links between them manually.
First off is to create the Silverlight Application. Now a Silverlight Solution consists in the first instance of two projects – The Silverlight application itself and a web application to host it.
- Select Silverlight Application template
- In the New Silverlight Application Window there is a checkbox labelled ‘Host the Silverlight application in a new Web site’. As this is a new solution we want this checked. If you were adding this project to an existing solution you do get the option to add Silverlight to the app, but in this instance we can keep it clicked
- The next option of interest is the Silverlight version. For Visual Studio 2010 it will default to Silverlight 4 which I want to use.
- The Final option Enable RIA Services also needs to be checked. Now although this does not refer to WCF RIA Services – RIA Services was renamed to refer to it and in reality there are effectively the same thing.
That gets the initial project created, clicking on OK allows Visual Studio to go away and create all of the projects and links required for the application. Now it is time for the Middle and Back End Tiers.
- Click on the Solution in the Solution Explorer,
- Right Click and then Select Add, New Project
- Select the WCF RIA Services Class Library
- Give it a name
- Then Click on OK
Again Visual Studio goes on to create the projects. When it is finished you will have a new folder which contains two projects; one ending in .Web which contains an empty class and another project.
So having created the RIA Class project you should have the a Services Library containing two folders, a Silverlight Application Project and a Web Project. Now is the time to wire up the refences between the Middle/Back Tier and the Silverlight Application.
Right Click on the Silverlight Host Website References and Select the project option. Select the WCF RIA Services Web Host
Right Click on the Silverlight Application References and Select the project option. Now select the WCF RIA Services Class.
When this is done you should have something like the following setup;
So there we have it. The project is now created, we have linked the Backend. Time to get writing some code.