Windows 2012 Hosting - MVC 6 and SQL 2014 BLOG

Tutorial and Articles about Windows Hosting, SQL Hosting, MVC Hosting, and Silverlight Hosting

ASP.NET MVC 3 Hosting - ASPHostPortal :: Global Action Filters in ASP.NET MVC 3

clock April 19, 2011 05:25 by author Jervis

Action Filters are a great way to handle cross-cutting concerns in ASP.NET MVC such as Logging, ExceptionHandling, etc.  In previous versions of MVC3, action filters have to be explicitly added to each controller. 

MVC3 adds the concept of Global Action Filters which allow you to apply action filters globally without the need for explicit declaration.  In this example, we’ll demonstrate how to add a debug action filter attribute that shows debug information for each view using Global Action Filters.

DebugInfoAttribute.cs

/// <summary>
    /// Displays the elapsed time and environment for each executed action in the HTTP Response Stream.
    /// </summary>
    public class DebugInfoAttribute : ActionFilterAttribute
    {
        readonly Stopwatch _startWatch = new Stopwatch();
        private static string _outputFormat = "<h4>Debug Environment Info</h4><div class=\"debuginfo\"><table><tr><td>Web Server:</td><td>{0}</td></tr><tr><td>Browser:</td><td>{1}</td></tr><tr><td>Controller</td><td>{3}</td></tr><tr><td>Action:</td><td>{4}</td></tr><tr><td>Execution Time(ms):</td><td>{5}</td></tr></table></div>";
        public override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            _startWatch.Start();
        } 

        public override void OnResultExecuted(ResultExecutedContext filterContext)
        {
            _startWatch.Stop();
            var browser = filterContext.HttpContext.Request.Browser;
            filterContext.HttpContext.Response.Write(string.Format(_outputFormat,
                                                                   HttpContext.Current.Request.ServerVariables[
                                                                       "SERVER_NAME"],
                                                                   String.Format("{0} ({1})",browser.Browser,browser.Version),
                                                                       filterContext.RouteData.Values["controller"],???????????????
                                                                       filterContext.RouteData.Values["action"],
                                                                       _startWatch.ElapsedMilliseconds));
        }
    }

This action filter uses the StopWatch object to clock how long the action took to execute, and displays that information in a view.

It’s applied normally by adding the “DebugInfo” attribute to the top of a controller class, as below.

[DebugInfo]
    public class HomeController : Controller

This results in the output seen below on our views:



If we click the “LogOn” link on our default application, we won’t see this information as we haven’t applied this filter to the “Account” controller.  Lets see how we can set an action filter to display gloablly.

Registering Global Action Filters

MVC3 adds a new function into our Global.asax called Register Global Filters.  To apply a filter globally, simply add a new line specifying your action filter as below.

public static void RegisterGlobalFilters(GlobalFilterCollection filters)
        {
            filters.Add(new HandleErrorAttribute());
            filters.Add(new DebugInfoAttribute());
        }

Now, when we click on the “Log On” link, we can see the DebugInfo filter has been automatically applied to the Account controller.



Reasons why you must trust ASPHostPortal.com

Every provider will tell you how they treat their support, uptime, expertise, guarantees, etc., are. Take a close look. What they’re really offering you is nothing close to what ASPHostPortal does. You will be treated with respect and provided the courtesy and service you would expect from a world-class web hosting business.


You’ll have highly trained, skilled professional technical support people ready, willing, and wanting to help you 24 hours a day. Your web hosting account servers are monitored from three monitoring points, with two alert points, every minute, 24 hours a day, 7 days a week, 365 days a year. The followings are the list of other added- benefits you can find when hosting with us:

- DELL Hardware
Dell hardware is engineered to keep critical enterprise applications running around the clock with clustered solutions fully tested and certified by Dell and other leading operating system and application providers.
- Recovery Systems
Recovery becomes easy and seamless with our fully managed backup services. We monitor your server to ensure your data is properly backed up and recoverable so when the time comes, you can easily repair or recover your data.
- Control Panel
We provide one of the most comprehensive customer control panels available. Providing maximum control and ease of use, our Control Panel serves as the central management point for your ASPHostPortal account. You’ll use a flexible, powerful hosting control panel that will give you direct control over your web hosting account. Our control panel and systems configuration is fully automated and this means your settings are configured automatically and instantly.
- Excellent Expertise in Technology
The reason we can provide you with a great amount of power, flexibility, and simplicity at such a discounted price is due to incredible efficiencies within our business. We have not just been providing hosting for many clients for years, we have also been researching, developing, and innovating every aspect of our operations, systems, procedures, strategy, management, and teams. Our operations are based on a continual improvement program where we review thousands of systems, operational and management metrics in real-time, to fine-tune every aspect of our operation and activities. We continually train and retrain all people in our teams. We provide all people in our teams with the time, space, and inspiration to research, understand, and explore the Internet in search of greater knowledge. We do this while providing you with the best hosting services for the lowest possible price.
- Data Center
ASPHostPortal modular Tier-3 data center was specifically designed to be a world-class web hosting facility totally dedicated to uncompromised performance and security
- Monitoring Services
From the moment your server is connected to our network it is monitored for connectivity, disk, memory and CPU utilization – as well as hardware failures. Our engineers are alerted to potential issues before they become critical.
- Network
ASPHostPortal has architected its network like no other hosting company. Every facet of our network infrastructure scales to gigabit speeds with no single point of failure.
- Security
Network security and the security of your server are ASPHostPortal’s top priorities. Our security team is constantly monitoring the entire network for unusual or suspicious behavior so that when it is detected we can address the issue before our network or your server is affected.
- Support Services
Engineers staff our data center 24 hours a day, 7 days a week, 365 days a year to manage the network infrastructure and oversee top-of-the-line servers that host our clients’ critical sites and services.



ASP.NET MVC 3 Hosting - ASPHostPortal :: How to Install ASP.NET MVC 3

clock April 18, 2011 07:22 by author Jervis

Microsoft's release of ASP.NET MVC 3 offers developers a new and improved framework for building web applications in the Model-View-Controller pattern. As expected, ASP.NET MVC 3 comes with many new features that improve on the ones present in MVC 1 and 2. It can also be installed side-by-side with ASP.NET MVC 2. Before we discuss ASP.NET MVC 3's installation process, let's discuss some of the framework's new features first.

The new Razor view engine comes with plenty of useful features within itself, such as HTML helpers.  It is based on well-known languages such as Visual Basic and C#, so its learning curve is minimal.  The view engine also helps to improve efficiency by cutting down on keystrokes with syntax that is short and to the point.  You can unit test Razor views without having to run an application or launch a web server as well.

ASP.NET MVC 3 also offers support for multiple view engines and implements various controller improvements. The new ViewBag property is one controller improvement that is similar to the ViewData property, but offers a simpler syntax.  Other controller improvements in MVC 3 include some new ActionResult types and global action filters.

The realms of JavaScript and Ajax have drawn some improvements as well.  For example, client-side validation is now enabled by default, and JSON binding support has been integrated.  ASP.NET MVC 3's other highlights include better support for dependency injection, model validation improvements, partial-page output caching, sessionless controller support, and more.

Now that you have a preview of some of the improvements that ASP.NET MVC 3 has to offer, it's time to download and install the framework.

To begin installing ASP.NET MVC 3, visit the following link:

http://www.microsoft.com/web/gallery/install.aspx?appid=MVC3

Before you start the download, there are some system requirements to keep in mind.  For the installer to work, you will need to have administrator privileges on your computer.  You will also need to be using one of the following operating systems:

Windows 7, Windows Vista, Windows Vista SP1, Windows XP SP2+, Windows Server 2008, Windows Server 2008 R2, or Windows Server 2003 SP1+.



Begin the installation by clicking on Install Now.  Depending on which internet browser you are using, you may be asked to either save the installer file or run it.  After you have saved the file and it has downloaded, locate it and double-click to begin the installation using Microsoft's Web Platform Installer.



Once the installer appears, click Install.



A window will appear that displays the different components that will be installed.  Once you have looked over the components, click I Accept.  The installation should now begin.  The process could take a while, so give it some time to complete.



After the installation is completed, a congratulations window will appear.  Click Finish to exit the installation.

Reasons why you must trust ASPHostPortal.com

Every provider will tell you how they treat their support, uptime, expertise, guarantees, etc., are. Take a close look. What they’re really offering you is nothing close to what ASPHostPortal does. You will be treated with respect and provided the courtesy and service you would expect from a world-class web hosting business.


You’ll have highly trained, skilled professional technical support people ready, willing, and wanting to help you 24 hours a day. Your web hosting account servers are monitored from three monitoring points, with two alert points, every minute, 24 hours a day, 7 days a week, 365 days a year. The followings are the list of other added- benefits you can find when hosting with us:

- DELL Hardware
Dell hardware is engineered to keep critical enterprise applications running around the clock with clustered solutions fully tested and certified by Dell and other leading operating system and application providers.
- Recovery Systems
Recovery becomes easy and seamless with our fully managed backup services. We monitor your server to ensure your data is properly backed up and recoverable so when the time comes, you can easily repair or recover your data.
- Control Panel
We provide one of the most comprehensive customer control panels available. Providing maximum control and ease of use, our Control Panel serves as the central management point for your ASPHostPortal account. You’ll use a flexible, powerful hosting control panel that will give you direct control over your web hosting account. Our control panel and systems configuration is fully automated and this means your settings are configured automatically and instantly.
- Excellent Expertise in Technology
The reason we can provide you with a great amount of power, flexibility, and simplicity at such a discounted price is due to incredible efficiencies within our business. We have not just been providing hosting for many clients for years, we have also been researching, developing, and innovating every aspect of our operations, systems, procedures, strategy, management, and teams. Our operations are based on a continual improvement program where we review thousands of systems, operational and management metrics in real-time, to fine-tune every aspect of our operation and activities. We continually train and retrain all people in our teams. We provide all people in our teams with the time, space, and inspiration to research, understand, and explore the Internet in search of greater knowledge. We do this while providing you with the best hosting services for the lowest possible price.
- Data Center
ASPHostPortal modular Tier-3 data center was specifically designed to be a world-class web hosting facility totally dedicated to uncompromised performance and security
- Monitoring Services
From the moment your server is connected to our network it is monitored for connectivity, disk, memory and CPU utilization – as well as hardware failures. Our engineers are alerted to potential issues before they become critical.
- Network
ASPHostPortal has architected its network like no other hosting company. Every facet of our network infrastructure scales to gigabit speeds with no single point of failure.
- Security
Network security and the security of your server are ASPHostPortal’s top priorities. Our security team is constantly monitoring the entire network for unusual or suspicious behavior so that when it is detected we can address the issue before our network or your server is affected.
- Support Services
Engineers staff our data center 24 hours a day, 7 days a week, 365 days a year to manage the network infrastructure and oversee top-of-the-line servers that host our clients’ critical sites and services.



Visual Studio LightSwitch Hosting - ASPHostPortal :: LightSwitch Tutorial – Creating a Basic Application

clock April 14, 2011 06:48 by author Jervis

This tutorial will demonstrate the creation of a simple LightSwitch application which will be a simple customers application with a single table of customers.

Create a New LightSwitch Project

1. Start up Visual Studio LightSwitch from 
Start > All Programs > Microsoft Visual Studio 2010 > Microsoft Visual Studio 2010.

2. Select File > New Project and the New Project dialog box will appear.


3. From the Installed Templates listing, select the LightSwitch. (Note that if you are using the full version of Visual Studio Professional with LightSwitch installed you will be shown more templates than just the LightSwitch templates).

4. Select the LightSwitch Application (Visual Basic) template which we will use for this demo and enter a name for the project (in this case I have used lightswitchdemo)





5. Once the application has been created you will be shown an option to either Create a New Table (if the app is being created with an all new database) or Attach to External Database if you need to use LightSwitch as a front-end to an existing database. For this tutorial we will select Create a New Table:



Before we proceed, note the structure of the LightSwitch project from the Solution Explorer in Visual Studio. There are three elements :


-
Properties – which is main configuration settings for LightSwitch, such as whether the app will be deployed as as a browser app or a stand-alone desktop app.

-
Data Sources – the data tables being used to data storage by the LightSwitch app.

-
Screens – the front-end ‘screens’ or pages which the end user will use to interact with the application.

Creating a Data Table in LightSwitch

In this section of the tutorial we will create a table for storing the company’s customer data

1.
Click Create new Table from the screen shown above (alternatively you can right-click on Data Sources in the Solution Explorer and select Add Table).

2.
Enter the details for each field in the table entry form. In this demo of a customers data tables I have used the fields FirstName, LastName, Email and PhoneNumber. Set the data type for each field, the default type is String, but note the types of EmailAddress and PhoneNumber which have inbuilt validation (as we will see in later tutorials) and should be used whenever possible for these fields. Save the fields by click Control+S or the save icon in the Visual Studio toolbar. For this tutorial I have set all fields to Required, but note that you will often want to uncheck this requirement for some fields to make their input option.



3. Change the table name to Customers by right-clicking on the table (currently named TableItem1) under Data Sources > ApplicationData , and then selecting Rename

Display Customer Data in an Editable Grid

In this final part of the tutorial we will create a simple one screen grid which the user will be able to view, edit and add customers to the LightSwitch application.

1. Right-click on Screens in the Visual Studio Solution Explorer and then select Add Screen…  You will then be shown the below screen which lists out the current screen templates available for creating user interfaces in LightSwitch



2. Select Editable Grid Screen from the Listing, enter EditableCustomerGrid as the Screen Name  (note that you cannot use spaces for the Screen Name) and select Customers for the Screen Data as shown below and then click OK and the screen should be immediately visible user the Screens folder in the Solution Explorer. Note that for a real-world app we would probably be creating several screens for the app such as a dedicated New Data Screen for inputing data, a Search Screen for performing searches and a Details Screen to display the data.



3. The Properties window should be automatically open, but if not just double-click the EditableCustomerGrid icon in the Solution Explorer. The full listing of screen properties as shown below:



4. Change the Display Name from EditableCustomerGrid to Customers (this is the name of the screen that will be shown to the end-user). Then Save the changes

That’s all that is required to create a very simple LightSwitch app.

Testing and Running the LightSwitch Application From Visual Studio


1. Once the application has been created and saved  hit F5 to run it. The application’s main window (see below)is partitioned into three main areas:
Ribbon: This area at the top of the screen gives quick access to common tasks which are performed in the LightSwitch application. The default tasks in the Ribbon are saving the current changes and refreshing the data source.

- Navigation Pane: On the left of the screen the Navigate Pane lists  the apps screens.
- Main Pane: The main active working screen. To change screens click another screen from the Navigation View.



2. Using the grid you can enter customer data. Note that on data types such as Email and Phone Number, the validation is built in.



3. Once you have entered the data, click Save on the Ribbon and the data will be saved to the database.



Publish and Deploy a LightSwitch Application From Visual Studio

The deployment process for a LightSwitch application differs depending on the application type which has been selected for the application. The application can be set from by double-clicking Properties in the Solution Explorer and selecting the Application Type tab.  There are three  application types – Desktop 2 Tier which creates as a simple WPF desktop app, Desktop 3 Tier which creates a WCF app and uses IIS to connect to the data source and Browser Client 3 Tier which creates a browser based Silverlight app:



In this simple demo we are will leave the default, Desktop client 2 tier deployment.

To start the publication process, right-click the main application icon (in this case lightswitchdemo) and select Publish… , the Publish Application Wizard will then be launched:



The first step is to specific the location on the machine to place the application files on the Specify Publishing Preference page. On this page you also need to specify how to create the database, you can either be published directly to an existing database or create a script which can then be executed to create the database manually.



Next, in the Database Configuration specify the connection string for the database (note that the options would be different if you elected to create a database script).



Next, in the Prerequisites you can specify which additional components  to install for running the application



Finally, you are will be able to specify any additional settings such as connections to reporting servers.



That’s it! This is a very simple application without many of the features required for actual business apps. In later tutorials we will dive deeper into features of LightSwitch.

Reasons why you must trust ASPHostPortal.com

Every provider will tell you how they treat their support, uptime, expertise, guarantees, etc., are. Take a close look. What they’re really offering you is nothing close to what ASPHostPortal does. You will be treated with respect and provided the courtesy and service you would expect from a world-class web hosting business.

You’ll have highly trained, skilled professional technical support people ready, willing, and wanting to help you 24 hours a day. Your web hosting account servers are monitored from three monitoring points, with two alert points, every minute, 24 hours a day, 7 days a week, 365 days a year. The followings are the list of other added- benefits you can find when hosting with us:

-
DELL Hardware
Dell hardware is engineered to keep critical enterprise applications running around the clock with clustered solutions fully tested and certified by Dell and other leading operating system and application providers.
- Recovery Systems
Recovery becomes easy and seamless with our fully managed backup services. We monitor your server to ensure your data is properly backed up and recoverable so when the time comes, you can easily repair or recover your data.
- Control Panel
We provide one of the most comprehensive customer control panels available. Providing maximum control and ease of use, our Control Panel serves as the central management point for your ASPHostPortal account. You’ll use a flexible, powerful hosting control panel that will give you direct control over your web hosting account. Our control panel and systems configuration is fully automated and this means your settings are configured automatically and instantly.
- Excellent Expertise in Technology
The reason we can provide you with a great amount of power, flexibility, and simplicity at such a discounted price is due to incredible efficiencies within our business. We have not just been providing hosting for many clients for years, we have also been researching, developing, and innovating every aspect of our operations, systems, procedures, strategy, management, and teams. Our operations are based on a continual improvement program where we review thousands of systems, operational and management metrics in real-time, to fine-tune every aspect of our operation and activities. We continually train and retrain all people in our teams. We provide all people in our teams with the time, space, and inspiration to research, understand, and explore the Internet in search of greater knowledge. We do this while providing you with the best hosting services for the lowest possible price.
- Data Center
ASPHostPortal modular Tier-3 data center was specifically designed to be a world-class web hosting facility totally dedicated to uncompromised performance and security
- Monitoring Services
From the moment your server is connected to our network it is monitored for connectivity, disk, memory and CPU utilization – as well as hardware failures. Our engineers are alerted to potential issues before they become critical.
- Network
ASPHostPortal has architected its network like no other hosting company. Every facet of our network infrastructure scales to gigabit speeds with no single point of failure.
- Security
Network security and the security of your server are ASPHostPortal’s top priorities. Our security team is constantly monitoring the entire network for unusual or suspicious behavior so that when it is detected we can address the issue before our network or your server is affected.
- Support Services
Engineers staff our data center 24 hours a day, 7 days a week, 365 days a year to manage the network infrastructure and oversee top-of-the-line servers that host our clients’ critical sites and services.



SSRS 2008 Hosting - ASPHostPortal :: Using Report Parameters in SQL Server Reporting Services

clock April 13, 2011 07:41 by author Jervis

Introduction

When you are using reports, you need to have parameters that narrow down your report for better analysis. You will often see that you need to have more than one parameter, where the second parameter may depend on the first parameter, which many require you to refresh the second parameter depending on the first parameter.


In addition, you may have to have parameters with multiple and/or default values. This article addresses how to create parameters in SQL Server 2005 Reporting Services (SSRS).

Pre-Requests


To understand the article content, you should have a fair knowledge of creating a report in SSRS, as this article does review how to create a report in SSRS in detail. However, I will try to cover as much as possible when it comes to creation of SSRS report. Also, you will need to know how to write basic T-SQL queries joining two or more tables.

Resource wise, you need to have SQL Server 2005 installed with SQL Server Business Intelligence Development Studio. As I am going to use data in the AdventureWorks sample database, it will be easier if you have installed an AdventureWorks database with your version of SQL Server.

Sample Case

Since it is always helpful to the reader to explain things through example, let us assume we want to list out employees depending on their country, state/province and city. Users should have an option of selecting a country. Depending on the selection of country, we need to list state/provinces which belong to the selected country. After selecting a state, we should list all the related cities and the user should have the option of selecting one or more cities from the list. Depending on the selected city or cities, the user should get a final list of employees that fit the criteria.

Implementation

First, you must create a Report Server Project from SQL Server Business Intelligence, then add a report to the project. Next is to create a shared data source that is pointed to the AdventureWorks database. We now need to add a dataset for country. You can add this dataset from the dataset tab by selecting ‘<New Dataset> Option’ from the dataset list box. Then configure the dsCountry dataset as depicted in the below image.



The next task is to assign this dsCountry to a report parameter. Select the ‘Report Parameters’ option from the Report menu.

Below is an image of the screen you should see.



The options in the dialog box above are:

Name – Name of the parameter. When you select a value, that value is stored in this parameter. As this is a variable name, you cannot have special characters (*, ! or spaces, etc.) in this field.

Data Type – Data type of the parameter. Options of this field include: Boolean, Datetime, Integer, Float and String. In this case, we will chose ‘String’ for the country parameter.

Prompt – Prompt is what you see in the report. As this is a label, you can have any characters for the prompt.

The following attributes are as simple as their names indicate. The difference between Hidden and Internal is that hidden variable can be changed from mechanisms and internal variables cannot be changed.

The next step is to assign values for the parameters.

The non-queried option should be used when a parameter has fixed values, such as Yes/No, Male/Female etc. From query option is to fill values from a dataset to parameter. In this example, the dataset is dscountry and we need to fill in two values: value field and label field. The label field is what users will see and the value field is what will be stored in the parameter. In this case, Name is the label field while CountryRegionCode is the value field. For example, if the user selects the United Status, US will be stored in the Country parameter.

The next step is to assign default values. A default value makes it easier for users to work with reports because it makes the most probable value the user will chose the default value. For example, in this report users be selecting United States, so having United States being the default value makes it easier for the user to fill out the form.

Reasons why you must trust ASPHostPortal.com

Every provider will tell you how they treat their support, uptime, expertise, guarantees, etc., are. Take a close look. What they’re really offering you is nothing close to what ASPHostPortal does. You will be treated with respect and provided the courtesy and service you would expect from a world-class web hosting business.


You’ll have highly trained, skilled professional technical support people ready, willing, and wanting to help you 24 hours a day. Your web hosting account servers are monitored from three monitoring points, with two alert points, every minute, 24 hours a day, 7 days a week, 365 days a year. The followings are the list of other added- benefits you can find when hosting with us:

- DELL Hardware
Dell hardware is engineered to keep critical enterprise applications running around the clock with clustered solutions fully tested and certified by Dell and other leading operating system and application providers.
- Recovery Systems
Recovery becomes easy and seamless with our fully managed backup services. We monitor your server to ensure your data is properly backed up and recoverable so when the time comes, you can easily repair or recover your data.
- Control Panel
We provide one of the most comprehensive customer control panels available. Providing maximum control and ease of use, our Control Panel serves as the central management point for your ASPHostPortal account. You’ll use a flexible, powerful hosting control panel that will give you direct control over your web hosting account. Our control panel and systems configuration is fully automated and this means your settings are configured automatically and instantly.
- Excellent Expertise in Technology
The reason we can provide you with a great amount of power, flexibility, and simplicity at such a discounted price is due to incredible efficiencies within our business. We have not just been providing hosting for many clients for years, we have also been researching, developing, and innovating every aspect of our operations, systems, procedures, strategy, management, and teams. Our operations are based on a continual improvement program where we review thousands of systems, operational and management metrics in real-time, to fine-tune every aspect of our operation and activities. We continually train and retrain all people in our teams. We provide all people in our teams with the time, space, and inspiration to research, understand, and explore the Internet in search of greater knowledge. We do this while providing you with the best hosting services for the lowest possible price.
- Data Center
ASPHostPortal modular Tier-3 data center was specifically designed to be a world-class web hosting facility totally dedicated to uncompromised performance and security
- Monitoring Services
From the moment your server is connected to our network it is monitored for connectivity, disk, memory and CPU utilization – as well as hardware failures. Our engineers are alerted to potential issues before they become critical.
- Network
ASPHostPortal has architected its network like no other hosting company. Every facet of our network infrastructure scales to gigabit speeds with no single point of failure.
- Security
Network security and the security of your server are ASPHostPortal’s top priorities. Our security team is constantly monitoring the entire network for unusual or suspicious behavior so that when it is detected we can address the issue before our network or your server is affected.
- Support Services
Engineers staff our data center 24 hours a day, 7 days a week, 365 days a year to manage the network infrastructure and oversee top-of-the-line servers that host our clients’ critical sites and services.



SQL 2008 Hosting - ASPHostPortal :: Using SharePoint 2010 Access Services with SQL Reporting

clock April 13, 2011 07:16 by author Jervis

Issue:  Trying to run reports from SharePoint 2010 Access Services databases returns error statements.

Solution:  Use the
SQL Server 2008 R2 November CTP with Reporting Services in SharePoint Integration mode, then install the SQL Server 2008 R2 November CTP Reporting Services add-in and follow the steps below.

1. Configure Reporting Services

Go to Central Adminà General Application Settingsà Reporting Services section

2. Add a report server to the integration

3. Perform the reporting services integration

4. Next
, go to
C:\Program Files\Microsoft SQL Server\MSRS10_50.MSSQLSERVER\Reporting Services\ReportServer\rsreportserver.config

Remove the comment markers (<!-- -->) off of the Data Extension for ADS.

<Extension Name="ADS" Type="Microsoft.Office.Access.Reports.DataProcessing.AdsConnection, Microsoft.Office.Access.Server.DataServer, Version=14.0.0.0, Culture=Neutral, PublicKeyToken=71e9bce111e9429c"/>

5. Once the comments were removed from the ADS extension, the SQL reports began working immediately.

Hope it helps!!

Reasons why you must trust ASPHostPortal.com

Every provider will tell you how they treat their support, uptime, expertise, guarantees, etc., are. Take a close look. What they’re really offering you is nothing close to what ASPHostPortal does. You will be treated with respect and provided the courtesy and service you would expect from a world-class web hosting business.


You’ll have highly trained, skilled professional technical support people ready, willing, and wanting to help you 24 hours a day. Your web hosting account servers are monitored from three monitoring points, with two alert points, every minute, 24 hours a day, 7 days a week, 365 days a year. The followings are the list of other added- benefits you can find when hosting with us:

- DELL Hardware
Dell hardware is engineered to keep critical enterprise applications running around the clock with clustered solutions fully tested and certified by Dell and other leading operating system and application providers.
- Recovery Systems
Recovery becomes easy and seamless with our fully managed backup services. We monitor your server to ensure your data is properly backed up and recoverable so when the time comes, you can easily repair or recover your data.
- Control Panel
We provide one of the most comprehensive customer control panels available. Providing maximum control and ease of use, our Control Panel serves as the central management point for your ASPHostPortal account. You’ll use a flexible, powerful hosting control panel that will give you direct control over your web hosting account. Our control panel and systems configuration is fully automated and this means your settings are configured automatically and instantly.
- Excellent Expertise in Technology
The reason we can provide you with a great amount of power, flexibility, and simplicity at such a discounted price is due to incredible efficiencies within our business. We have not just been providing hosting for many clients for years, we have also been researching, developing, and innovating every aspect of our operations, systems, procedures, strategy, management, and teams. Our operations are based on a continual improvement program where we review thousands of systems, operational and management metrics in real-time, to fine-tune every aspect of our operation and activities. We continually train and retrain all people in our teams. We provide all people in our teams with the time, space, and inspiration to research, understand, and explore the Internet in search of greater knowledge. We do this while providing you with the best hosting services for the lowest possible price.
- Data Center
ASPHostPortal modular Tier-3 data center was specifically designed to be a world-class web hosting facility totally dedicated to uncompromised performance and security
- Monitoring Services
From the moment your server is connected to our network it is monitored for connectivity, disk, memory and CPU utilization – as well as hardware failures. Our engineers are alerted to potential issues before they become critical.
- Network
ASPHostPortal has architected its network like no other hosting company. Every facet of our network infrastructure scales to gigabit speeds with no single point of failure.
- Security
Network security and the security of your server are ASPHostPortal’s top priorities. Our security team is constantly monitoring the entire network for unusual or suspicious behavior so that when it is detected we can address the issue before our network or your server is affected.
- Support Services
Engineers staff our data center 24 hours a day, 7 days a week, 365 days a year to manage the network infrastructure and oversee top-of-the-line servers that host our clients’ critical sites and services.



ASP.NET MVC 3 Hosting - ASPHostPortal :: Handling Forms in Spring 3.0 MVC

clock April 11, 2011 05:43 by author Jervis

Getting Started

Let us add the contact form to our Spring 3 MVC Hello World application. Open the index.jsp file and change it to following:


File: WebContent/index.jsp

<jsp:forward page="contacts.html"></jsp:forward>

The above code will just redirect the user to contacts.html page.


The View- contact.jsp

Create a JSP file that will display Contact form to our users.
File: /WebContent/WEB-INF/jsp/contact.jsp

<[email protected] uri="http://www.springframework.org/tags/form" prefix="form"%>
<html>
<head>
    <title>Spring 3 MVC Series - Contact Manager</title>
</head>
<body>
<h2>Contact Manager</h2>
<form:form method="post" action="addContact.html">   

    <table>
    <tr>
        <td><form:label path="firstname">First Name</form:label></td>
        <td><form:input path="firstname" /></td>
    </tr>
    <tr>
        <td><form:label path="lastname">Last Name</form:label></td>
        <td><form:input path="lastname" /></td>
    </tr>
    <tr>
        <td><form:label path="lastname">Email</form:label></td>
        <td><form:input path="email" /></td>
    </tr>
    <tr>
        <td><form:label path="lastname">Telephone</form:label></td>
        <td><form:input path="telephone" /></td>
    </tr>
    <tr>
        <td colspan="2">
            <input type="submit" value="Add Contact"/>
        </td>
    </tr>
</table>  
  
</form:form>
</body>
</html>

Here in above JSP, we have displayed a form. Note that the form is getting submitted to addContact.html page.

Adding Form and Controller in Spring 3

We will now add the logic in Spring 3 to display the form and fetch the values from it. For that we will create two java files. First the Contact.java which is nothing but the form to display/retrieve data from screen and second the ContactController.java which is the spring controller class.



File: net.viralpatel.spring3.form.Contact

package net.viralpatel.spring3.form;
  
public class Contact {

    private String firstname;
    private String lastname;
    private String email;
    private String telephone;   

    //.. getter and setter for all above fields.

}

The above file is the contact form which holds the data from screen. Note that I haven’t showed the getter and setter methods. You can generate these methods by pressiong Alt + Shift + S, R.

File: net.viralpatel.spring3.controller.ContactController

package net.viralpatel.spring3.controller;   


import net.viralpatel.spring3.form.Contact;   

import org.springframework.stereotype.Controller;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.SessionAttributes;
import org.springframework.web.servlet.ModelAndView;   

@Controller
@SessionAttributes
public class ContactController {   

    @RequestMapping(value = "/addContact", method = RequestMethod.POST)
    public String addContact(@ModelAttribute("contact")
                            Contact contact, BindingResult result) {   

        System.out.println("First Name:" + contact.getFirstname() +
                    "Last Name:" + contact.getLastname());   

        return "redirect:contacts.html";
    }   

    @RequestMapping("/contacts")
    public ModelAndView showContacts() {   

        return new ModelAndView("contact", "command", new Contact());
    }
}

In above controller class, note that we have created two methods with Request Mapping /contacts and /addContact. The method showContacts() will be called when user request for a url contacts.html. This method will render a model with name “contact”. Note that in the ModelAndView object we have passed a blank Contact object with name “command”. The spring framework expects an object with name command if you are using
in your JSP file.


Also note that in method addContact() we have annotated this method with RequestMapping and passed an attribute method=”RequestMethod.POST”. Thus the method will be called only when user generates a POST method request to the url /addContact.html. We have annotated the argument Contact with annotation @ModelAttribute. This will binds the data from request to the object Contact. In this method we just have printed values of Firstname and Lastname and redirected the view to cotnacts.html.

That’s all folks

The form is completed now. Just run the application in eclipse by pression Alt + Shift + X, R. It will show the contact form. Just enter view values and press Add button. Once you press the button, it will print the firstname and lastname in sysout logs.



Reasons why you must trust ASPHostPortal.com

Every provider will tell you how they treat their support, uptime, expertise, guarantees, etc., are. Take a close look. What they’re really offering you is nothing close to what ASPHostPortal does. You will be treated with respect and provided the courtesy and service you would expect from a world-class web hosting business.


You’ll have highly trained, skilled professional technical support people ready, willing, and wanting to help you 24 hours a day. Your web hosting account servers are monitored from three monitoring points, with two alert points, every minute, 24 hours a day, 7 days a week, 365 days a year. The followings are the list of other added- benefits you can find when hosting with us:

- DELL Hardware
Dell hardware is engineered to keep critical enterprise applications running around the clock with clustered solutions fully tested and certified by Dell and other leading operating system and application providers.
- Recovery Systems
Recovery becomes easy and seamless with our fully managed backup services. We monitor your server to ensure your data is properly backed up and recoverable so when the time comes, you can easily repair or recover your data.
- Control Panel
We provide one of the most comprehensive customer control panels available. Providing maximum control and ease of use, our Control Panel serves as the central management point for your ASPHostPortal account. You’ll use a flexible, powerful hosting control panel that will give you direct control over your web hosting account. Our control panel and systems configuration is fully automated and this means your settings are configured automatically and instantly.
- Excellent Expertise in Technology
The reason we can provide you with a great amount of power, flexibility, and simplicity at such a discounted price is due to incredible efficiencies within our business. We have not just been providing hosting for many clients for years, we have also been researching, developing, and innovating every aspect of our operations, systems, procedures, strategy, management, and teams. Our operations are based on a continual improvement program where we review thousands of systems, operational and management metrics in real-time, to fine-tune every aspect of our operation and activities. We continually train and retrain all people in our teams. We provide all people in our teams with the time, space, and inspiration to research, understand, and explore the Internet in search of greater knowledge. We do this while providing you with the best hosting services for the lowest possible price.
- Data Center
ASPHostPortal modular Tier-3 data center was specifically designed to be a world-class web hosting facility totally dedicated to uncompromised performance and security
- Monitoring Services
From the moment your server is connected to our network it is monitored for connectivity, disk, memory and CPU utilization – as well as hardware failures. Our engineers are alerted to potential issues before they become critical.
- Network
ASPHostPortal has architected its network like no other hosting company. Every facet of our network infrastructure scales to gigabit speeds with no single point of failure.
- Security
Network security and the security of your server are ASPHostPortal’s top priorities. Our security team is constantly monitoring the entire network for unusual or suspicious behavior so that when it is detected we can address the issue before our network or your server is affected.
- Support Services
Engineers staff our data center 24 hours a day, 7 days a week, 365 days a year to manage the network infrastructure and oversee top-of-the-line servers that host our clients’ critical sites and services.



ASP.NET MVC 3 Hosting - ASPHostPortal :: Tutorial - Getting Started with Spring 3 MVC

clock April 6, 2011 06:13 by author Jervis

The Spring Framework is constantly evolving. Spring MVC has gotten easier and easier to work with and with the SpringSource Tool Suite it gets even easier to get a Spring MVC project up and running. Today I’ll show you how to setup a simple Spring MVC project and add some simple functionality to it.

There are a few things you’ll need to complete this tutorial:

Java JDK installed
SpringSource Tool Suite – I downloaded the installer version, not the plug-in to Eclipse

With those two items installed and ready go ahead and run the SpringSource Tool Suite and create a new project: File -> New -> Spring Template Project



Note: It might prompt you to download the template, go ahead and let it do that.



Once the project has been created we can test out the default Hello World code that is already in-place. Lets add the project to the
SpringSource tc Server and then start it.



Once the SpringSource tc Server is up and running open a browser and head to this url:
http://localhost:8080/EchoSpringMVC/

If everything went well you should see this:









You can leave the SpringSource tc Server running.

Open the HomeController.java file now and add the following imports:

import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.ui.Model;

Lets add a new mapping and method for the echo functionality we are going to add.

@RequestMapping(value="/echo", method=RequestMethod.GET)
public String echo(@RequestParam("input1") String input1, Model model) {
    logger.info("Calling echo");
    String output = "Echo: " + input1;
    model.addAttribute("output", output);
    return "echo";
}

We set the mapping to handle any GET requests to echo. The echo method takes one parameter called input1 which we simply use to complete the echo functionality. The echo is passed back to the view (which we will create next).

Your HomeController.java should look like this:

package com.giantflyingsaucer.springmvc;   

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.ui.Model;   

/**
 * Handles requests for the application home page.
 */
@Controller
public class HomeController {   

    private static final Logger logger = LoggerFactory.getLogger(HomeController.class);

      /**
     * Simply selects the home view to render by returning its name.
     */
    @RequestMapping(value="/", method=RequestMethod.GET)
    public String home() {
        logger.info("Welcome home!");
        return "home";
    }   

    @RequestMapping(value="/echo", method=RequestMethod.GET)
    public String echo(@RequestParam("input1") String input1, Model model) {
        logger.info("Calling echo");
        String output = "Echo: " + input1;
        model.addAttribute("output", output);
        return "echo";
    }
}

Lets add a new JSP page for our echo view. Right-click on the webapp/WEB-INF/views folder and select:
New -> Other -> Web -> JSP File



Here are the contents for the new echo.jsp file:


<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ page session="false" %>
<html>
<head>
    <title>Echo</title>
</head>
<body>
<h1>
    <strong><c:out value="${output}"></c:out></strong>
</h1>
</body>
</html>

Save all the files and the SpringSource tc Server will reload the project automatically. When this has happened use this URL to trigger the echo: http://localhost:8080/EchoSpringMVC/echo?input1=HelloWorld

Your result should be:



Reasons why you must trust ASPHostPortal.com

Every provider will tell you how they treat their support, uptime, expertise, guarantees, etc., are. Take a close look. What they’re really offering you is nothing close to what ASPHostPortal does. You will be treated with respect and provided the courtesy and service you would expect from a world-class web hosting business.


You’ll have highly trained, skilled professional technical support people ready, willing, and wanting to help you 24 hours a day. Your web hosting account servers are monitored from three monitoring points, with two alert points, every minute, 24 hours a day, 7 days a week, 365 days a year. The followings are the list of other added- benefits you can find when hosting with us:

- DELL Hardware
Dell hardware is engineered to keep critical enterprise applications running around the clock with clustered solutions fully tested and certified by Dell and other leading operating system and application providers.
- Recovery Systems
Recovery becomes easy and seamless with our fully managed backup services. We monitor your server to ensure your data is properly backed up and recoverable so when the time comes, you can easily repair or recover your data.
- Control Panel
We provide one of the most comprehensive customer control panels available. Providing maximum control and ease of use, our Control Panel serves as the central management point for your ASPHostPortal account. You’ll use a flexible, powerful hosting control panel that will give you direct control over your web hosting account. Our control panel and systems configuration is fully automated and this means your settings are configured automatically and instantly.
- Excellent Expertise in Technology
The reason we can provide you with a great amount of power, flexibility, and simplicity at such a discounted price is due to incredible efficiencies within our business. We have not just been providing hosting for many clients for years, we have also been researching, developing, and innovating every aspect of our operations, systems, procedures, strategy, management, and teams. Our operations are based on a continual improvement program where we review thousands of systems, operational and management metrics in real-time, to fine-tune every aspect of our operation and activities. We continually train and retrain all people in our teams. We provide all people in our teams with the time, space, and inspiration to research, understand, and explore the Internet in search of greater knowledge. We do this while providing you with the best hosting services for the lowest possible price.
- Data Center
ASPHostPortal modular Tier-3 data center was specifically designed to be a world-class web hosting facility totally dedicated to uncompromised performance and security
- Monitoring Services
From the moment your server is connected to our network it is monitored for connectivity, disk, memory and CPU utilization – as well as hardware failures. Our engineers are alerted to potential issues before they become critical.
- Network
ASPHostPortal has architected its network like no other hosting company. Every facet of our network infrastructure scales to gigabit speeds with no single point of failure.
- Security
Network security and the security of your server are ASPHostPortal’s top priorities. Our security team is constantly monitoring the entire network for unusual or suspicious behavior so that when it is detected we can address the issue before our network or your server is affected.
- Support Services
Engineers staff our data center 24 hours a day, 7 days a week, 365 days a year to manage the network infrastructure and oversee top-of-the-line servers that host our clients’ critical sites and services.



ASP.NET MVC 3 Hosting - ASPHostPortal :: Problem in implementing IControllerActivator in ASP.NET MVC 3

clock April 5, 2011 07:35 by author Jervis

ASP.NET MVC 3 introduces two new interfaces to allow simple integration of IoC containers into the MVC pipeline, allowing many different types to be resolved using your IoC container of choice. These interfaces are IDependencyResolver and IControllerActivator but before you go ahead and implement both, let’s take a look at whether they are both actually needed.

First some background

If you wanted to inject dependencies into your controllers in ASP.NET MVC 2, you were required to either implement IControllerFactory or subclass DefaultControllerFactory. Typically, you would pass your IoC container into the constructor of your custom controller factory and use it to resolve the controller in the CreateController method. You may also have added custom code in ReleaseController to clean up dependencies

This worked reasonably well, but in ASP.NET MVC 3 things have changed so we can use DI for a whole host of other objects such as filters and view engines

The new interface that we should implement is IDependencyResolver:



The important thing about your implementation of this interface is that it should return null if it cannot resolve a particular object. Below is a simple implementation using Unity:



When an MVC application starts for the first time, the dependency resolver is called with the following types in the following order:
- IControllerFactory
- IControllerActivator
- HomeController
….

If you do not implement IControllerFactory or IControllerActivator, then the MVC framework will try to get the controller from the DependencyResolver itself. As a side note, there is no need to worry about performance (regarding so many calls to the resolver) because MVC will only try to resolve theIControllerFactory and IControllerActivator once on startup and if no implementations are registered then it will subsequently always query the DependencyResolver first

The MVC framework goes on to try to resolve many other types which you probably have not implemented or registered with your IoC container, but as long as your dependency resolver returns null if the type is not registered, MVC will default back to the built-in implementations

If you did not implement your resolver to return null if a type is not registered then you will probably end up seeing an error similar to:

The current type, System.Web.Mvc.IControllerFactory, is an interface and cannot be constructed

The other important thing to note is that both methods on this interface take in the actual service type. This typically means that when you register your controllers with your IoC container, you should only specify the concrete type, not the IController, interface

i.e. using Unity as an example:



rather than:



Failing to register your controllers conrrectly and you will see

No parameterless constructor defined for this object

So at this stage, we have an implementation of IDependencyResolver and nothing else and yet our controller are all resolving correctly. It makes you wonder about whether IControllerActivator is really needed…

About IControllerActivator


IControllerActivator was introduced with ASP.NET MVC 3 to split the functionality of the MVC 2 controller factory into two distinct classes. As far as we can tell, this was done to adhere to the Single Responsibility Principle (SRP). So now in MVC 3, the DefaultControllerFactory outsources the responsibility of actually instantiating the controller to the controller activator. The single method interface is shown below:



If you implement this interface and register your activator with your IoC container, the MVC framework will pick it up and use it when trying to instantiate controllers, but you have to wonder why you would do this instead of just letting your dependency resolver do it directly. Brad Wilson to the rescue:

“If your container can build arbitrary types, you don’t need to write activators. The activator services are there for containers that can’t be arbitrary types. MEF can’t, but you can add [Export] attributes to your controllers to allow MEF to build them…”


This means that if you are working with any competent IoC container* (Castle Windor, Unity, Ninject, StructureMap, Autofac et al), IControllerActivator is not needed and offers no benefit over allowing your DependencyResolver to instantiate your controllers.

* (With the exception of MEF which isn’t an IoC container any way)

So we now know that we are probably not required to implement this interface, but are there any benefits to doing so? Something that we have seen mentioned (we cannot remember where) is that implementing IControllerActivator allows you you can provide a more meaningful error message if resolution fails. It is true that the message you would get otherwise (No parameterless constructor defined for this object) is not 100% clear, but we are not sure that this justifies another class just for this purpose. Surely, once you have seen this message, the next time you encounter, it you will immediately know what the problem is. Even if you do implement IControllerActivator, you will not have access to the (normally) detailed message that you IoC container provides when resolution fails, so you can do little more than say resolution failed – i don’t know why.

Conclusion


So, should you implement IControllerActivator? Probably not. If you are using pretty much any well known IoC container, just implement IDependencyResolver and it will do everything for you. There is also no need for a custom implementation of IControllerFactory. If you are worried about the lack of release method on the dependency resolver, don’t be. The worst case scenario requires a small change to the way that you are using your IoC container. Next time we will talk about how to make sure your dependency resolver plays nicely with IDisposable.

Reasons why you must trust ASPHostPortal.com

Every provider will tell you how they treat their support, uptime, expertise, guarantees, etc., are. Take a close look. What they’re really offering you is nothing close to what ASPHostPortal does. You will be treated with respect and provided the courtesy and service you would expect from a world-class web hosting business.


You’ll have highly trained, skilled professional technical support people ready, willing, and wanting to help you 24 hours a day. Your web hosting account servers are monitored from three monitoring points, with two alert points, every minute, 24 hours a day, 7 days a week, 365 days a year. The followings are the list of other added- benefits you can find when hosting with us:

- DELL Hardware
Dell hardware is engineered to keep critical enterprise applications running around the clock with clustered solutions fully tested and certified by Dell and other leading operating system and application providers.
- Recovery Systems
Recovery becomes easy and seamless with our fully managed backup services. We monitor your server to ensure your data is properly backed up and recoverable so when the time comes, you can easily repair or recover your data.
- Control Panel
We provide one of the most comprehensive customer control panels available. Providing maximum control and ease of use, our Control Panel serves as the central management point for your ASPHostPortal account. You’ll use a flexible, powerful hosting control panel that will give you direct control over your web hosting account. Our control panel and systems configuration is fully automated and this means your settings are configured automatically and instantly.
- Excellent Expertise in Technology
The reason we can provide you with a great amount of power, flexibility, and simplicity at such a discounted price is due to incredible efficiencies within our business. We have not just been providing hosting for many clients for years, we have also been researching, developing, and innovating every aspect of our operations, systems, procedures, strategy, management, and teams. Our operations are based on a continual improvement program where we review thousands of systems, operational and management metrics in real-time, to fine-tune every aspect of our operation and activities. We continually train and retrain all people in our teams. We provide all people in our teams with the time, space, and inspiration to research, understand, and explore the Internet in search of greater knowledge. We do this while providing you with the best hosting services for the lowest possible price.
- Data Center
ASPHostPortal modular Tier-3 data center was specifically designed to be a world-class web hosting facility totally dedicated to uncompromised performance and security
- Monitoring Services
From the moment your server is connected to our network it is monitored for connectivity, disk, memory and CPU utilization – as well as hardware failures. Our engineers are alerted to potential issues before they become critical.
- Network
ASPHostPortal has architected its network like no other hosting company. Every facet of our network infrastructure scales to gigabit speeds with no single point of failure.
- Security
Network security and the security of your server are ASPHostPortal’s top priorities. Our security team is constantly monitoring the entire network for unusual or suspicious behavior so that when it is detected we can address the issue before our network or your server is affected.
- Support Services
Engineers staff our data center 24 hours a day, 7 days a week, 365 days a year to manage the network infrastructure and oversee top-of-the-line servers that host our clients’ critical sites and services.



Silverlight 4 Hosting - ASPHostPortal :: Getting Started with WCF RIA Services for Silverlight 4

clock April 4, 2011 07:03 by author Jervis

What is so great about RIA Services?

RIA Services mainly targets Business Application Development, and comes across good for this purpose from a few different angles.


1. RIA Services simplifies the traditional n-tier application pattern by bringing together the ASP.NET and Silverlight platforms. If you have ever gone through the motions of creating a WCF Service, and then adding a service reference to your Silverlight project you will quickly find that the service calls are all asynchronous, and require you to specify an OnRequestCompleated method for calls that you make to that web service. While there are asynchronous programming patterns out there most business application developers prefer the tried and true N-Tier approach. Asynchronous Method calls make N-Tier Architecture difficult

2. As stated above Ria simplifies tiered architecture this means it is a great choice for creating applications using some of the more popular architectural patterns like MVVM, and MVC.

3. Because RIA Services is from Microsoft, you get tight Visual Studio Integration, and lots of Blogs, and Documentation covering it's use. While some of the open source projects out there are pretty good, most lake adequate documentation and have a steep learning curve.

4. Ria Services is flat out great for Rapid Application Development. There is Code Generation generation built into Visual Studio to generate Domain Services directly from ADO.NET Entities Models that your Silverlight applications can consume.

Where Can I Get WCF RIA Services

You can Get Wcf Ria Services From the Microsoft Web Platform Installer, located here.

1. Highlight the Web Platform Tab
2. Scroll Down to Tools
3. Click the customize Tab
4. and check off what you need



If you don't have Visual Studio go ahead and check off to get the Express Version. You obviously want to get the RIA Services Toolkit, and while you're here get the the Silverlight 4 Toolkit, and Tools for Visual Studio as well. After the install completes you will have everything you need to work with Silverlight 4 and RIA Services from within Visual Studio.

Options for Integrating WCF RIA Services into your Projects

There are a few different way out of the box to integrate WCF RIA Services into your projects using Visual Studio

1. Using the Silverlight Business Application Project Template
2. ling RIA Services in the Silverlight Application Project Template
3. Using the RIA Services Class Library Project Template

In this post we take a look at each of these approaches, talk about when and how they are useful, and show how implement each one. For this purpose I have created a Visual Studio Solution containing each implementation listed above



In the real world you are not likely to have a solution which implements any combination of these approaches, but for this example it is nice to have them all in one place to look at.

The Silverlight Business Application Project

If you are creating an application that requires Login, Registration, and User Authentication the Silverlight Business Application Project Template is a good way to go. It includes all this right out of the box. It also has website like layout and styles you can customize and some useful helper methods. You can actually learn a few things just by creating this project and then giving it a gook look over.

To create a Silverlight Business Application:

Right Click on your Solution and select "Add New Project", Select "Silverlight" from the Tree Menu on the Left, and then Select "Silverlight Business Application".

This will create a new two Projects in you solution automatically



You now have a Web Application Project to host your Silverlight Application and Domain Services, and The RIA Link between the two projects is all set up so you can begin adding and consuming WCF RIA Services. If you run the project now you will see all the out of the box features I mentioned are there.

Configurable Layout and Styles



Login



Registration



Not bad for right out of the box. I do have a couple of small issues with this though. Sure, it's great Microsoft has given us all this stuff without having to write a single line of code, but, I would have a couple things different if it were up to me.

1. I wish the project template had a few config options upon creation. For example, for larger projects I may want all my services to be in a WCF RIA Services Class Library (RIA Class Library covered in detail below) in  instead of in the Web Application Project. Now I would have to move them.

2. I'm not really sure what kind of Architectural Pattern they are trying to implement here. As you can see from the image of the Solution Explorer above there is a folder named "Models" in both the Web Application Project, and in the silverlight project. Then there is a Views folder in the Silverlight project that has views in it, but then no ViewModels or Controllers. Okay, so my point is what are they going for here? It makes me want to start moving the code around. If I'm not alone on this please leave me a comment.

Anyway, small issues compared to the big picture.

WCF RIA Services Enabled Silverlight Application

If you don't need all the stuff that's included in the Silverlight Business Application above, or plan to just write them yourself, you can also enable RIA Services in a regular silverlight application.

To create a WCF RIA Services Enabled Silverlight Application:

Right Click on your Solution and select "Add New Project", Select "Silverlight" from the Tree Menu on the Left, and then Select "Silverlight Application".



When you click OK to add the new Silverlight Application a Dialog will appearer allowing you create a New Web Application to host your Silverlight Application in, or to host your Silverlight Application in an existing Web Project. Either way all you need to do is check the box to "Enable WCF RIA Services".



Then when your Project is created, it will already be set up to use RIA Services. You can now start adding domain services to your web project and the RIA link is in place and ready to go.

WCF RIA Services Class Library

The last option is the WCF RIA Services Class Library. In my experience the more separation you have in your solution the better. This project template allows you to house your Domain Services in separate assemblies.

To create a Solution that uses a WCF RIA Services Class Library:

Right Click on your Solution and select "Add New Project", Select "Silverlight" from the Tree Menu on the Left, and then Select "Silverlight Application".



When the project Dialog box appears allowing you to host your silverlight application in an existing or new Web Application, leave the "Enable WCF RIA Services" checkbox UN-CHECKED. The RIA Link will exist in the RIA Services Class Library.



Now right Click on your Solution and select "Add New Project", Select "Silverlight" from the Tree Menu on the Left, and then Select "WCF RIA Services Class Library".



This will actually create two projects. The RIA Services Class Library Consists of a Windows Class Library and a Silverlight Class Library and the two projects created contain the RIA Link. The project ending in .Web is the Windows Class Library and will run on the server while the other is the Silverlight Class Library will run on the client. Your solution should now look something like this.



All you need to do now is:

1. Add a reference to the Silverlight Class Library in your Silverlight Application
2. Add a reference to the Windows Class Library in your Web Application

And you are now set up and ready to start adding Domain Services to your server project for consumption in your Web Project. When using this set up you should add your domain services to you Windows Class Library section of your RIA Services Class Library.

Creating and Consuming Domain Services

Now that we know how to set up our RIA Services Project, Lets take a look at adding a Domain Service and consuming it in out Silverlight client to test that we have everything wired up correctly. In all of the scenarios listed above you will always add your Domain Service on the server side and consume that service on the Silverlight Client.

To show you how quick and easy it is to get a Domain Service up and running we are going to create a Domain Service form and ADO.NET Entities Data Model.

Start by Creating a Database. Mine consist of only one table with a very simple schema for this example.



Now right Click on your Web Project and select "Add New Item", Select "Data" from the Tree Menu on the Left, and then Select "ADO.NET Entity Data Model".



Highlight "Generate From Database" and click "Next".



Select your Target Database and click "Next".



Select the tables you want to generate the Model from and click "Finish".



Now that your Entities Data Model has been created do a Rebuild on the project before you do any thing else. This is important because if you forget to rebuild what will happen is when you go to create the Domain Service it will not be able to find your Entities. So go ahead and rebuild now and then we can create out first Domain Service.

Now right Click on your Web Project and select "Add New Item", Select "Web" from the Tree Menu on the Left, and then Select "Domain Service Class".



Click "Add" and you will get a Dialog Box Allowing you to generate your Domain Service from your entities. Select Enable Editing if you want it to Generate Update, Insert and Delete methods as well.



Now Click "OK" and it will generate your Domain Service class. It will look something like this.

[EnableClientAccess()]   
    public class ContactDomainService : LinqToEntitiesDomainService   
    {     

        // TODO:   
        // Consider constraining the results of your query method.  If you need additional input you can   
        // add parameters to this method or create additional query methods with different names.   
        // To support paging you will need to add ordering to the 'Contacts' query.   
        public IQueryable GetContacts()   
        {   
            return this.ObjectContext.Contacts;   
        }     

        public void InsertContact(Contact contact)   
        {   
            if ((contact.EntityState != EntityState.Detached))   
            {   
                this.ObjectContext.ObjectStateManager.ChangeObjectState(contact, EntityState.Added);   
            }   
            else  
            {   
                this.ObjectContext.Contacts.AddObject(contact);   
            }   

        }     

        public void UpdateContact(Contact currentContact)   
        {   
            this.ObjectContext.Contacts.AttachAsModified(currentContact, this.ChangeSet.GetOriginal(currentContact));   
        }     

        public void DeleteContact(Contact contact)   
        {   
            if ((contact.EntityState == EntityState.Detached))   
            {   
                this.ObjectContext.Contacts.Attach(contact);   
            }   
            this.ObjectContext.Contacts.DeleteObject(contact);   
        }   
    }

Notice it created services methods to preform all the CRUD opperations we need against our Database.

Now in our Silverlight project we will create a Grid in our MainPage.xaml to display our data like so:

<
sdk:DataGrid x:Name="DataGrid" Margin="12" AutoGenerateColumns="True" />

Then in the code behind (MainPage.xaml.cs) we will add the code to call our domain service and populate our grid.

1. You will need to add a using directive to the Namespace in your server project where your domain services are located.
2. Create a private instance of your DomainContext
3. In the constructor call the load method of your context and pass in your GetContactsQuery from your Domain Service
4. Set the ItemSource Property of your DataGrid to the Collection of Contacts now available in your DataContext.

using SilverlightApplication3.Web;     

namespace SilverlightApplication3   
{   
    public partial class MainPage : UserControl   
    {   
        private ContactDomainContext _context = new ContactDomainContext();  

        public MainPage()   
        {   
            InitializeComponent();   
            _context.Load(_context.GetContactsQuery());   
            DataGrid.ItemsSource = _context.Contacts;   
        }   
    }   


Now hit F5 and run the application. TADA! You should now see your data in the grid!



I hope this helped you in getting started with .NET RIA Services. I will be covering more in future posts.

Reasons why you must trust ASPHostPortal.com

Every provider will tell you how they treat their support, uptime, expertise, guarantees, etc., are. Take a close look. What they’re really offering you is nothing close to what ASPHostPortal does. You will be treated with respect and provided the courtesy and service you would expect from a world-class web hosting business.


You’ll have highly trained, skilled professional technical support people ready, willing, and wanting to help you 24 hours a day. Your web hosting account servers are monitored from three monitoring points, with two alert points, every minute, 24 hours a day, 7 days a week, 365 days a year. The followings are the list of other added- benefits you can find when hosting with us:

- DELL Hardware
Dell hardware is engineered to keep critical enterprise applications running around the clock with clustered solutions fully tested and certified by Dell and other leading operating system and application providers.
- Recovery Systems
Recovery becomes easy and seamless with our fully managed backup services. We monitor your server to ensure your data is properly backed up and recoverable so when the time comes, you can easily repair or recover your data.
- Control Panel
We provide one of the most comprehensive customer control panels available. Providing maximum control and ease of use, our Control Panel serves as the central management point for your ASPHostPortal account. You’ll use a flexible, powerful hosting control panel that will give you direct control over your web hosting account. Our control panel and systems configuration is fully automated and this means your settings are configured automatically and instantly.
- Excellent Expertise in Technology
The reason we can provide you with a great amount of power, flexibility, and simplicity at such a discounted price is due to incredible efficiencies within our business. We have not just been providing hosting for many clients for years, we have also been researching, developing, and innovating every aspect of our operations, systems, procedures, strategy, management, and teams. Our operations are based on a continual improvement program where we review thousands of systems, operational and management metrics in real-time, to fine-tune every aspect of our operation and activities. We continually train and retrain all people in our teams. We provide all people in our teams with the time, space, and inspiration to research, understand, and explore the Internet in search of greater knowledge. We do this while providing you with the best hosting services for the lowest possible price.
- Data Center
ASPHostPortal modular Tier-3 data center was specifically designed to be a world-class web hosting facility totally dedicated to uncompromised performance and security
- Monitoring Services
From the moment your server is connected to our network it is monitored for connectivity, disk, memory and CPU utilization – as well as hardware failures. Our engineers are alerted to potential issues before they become critical.
- Network
ASPHostPortal has architected its network like no other hosting company. Every facet of our network infrastructure scales to gigabit speeds with no single point of failure.
- Security
Network security and the security of your server are ASPHostPortal’s top priorities. Our security team is constantly monitoring the entire network for unusual or suspicious behavior so that when it is detected we can address the issue before our network or your server is affected.
- Support Services
Engineers staff our data center 24 hours a day, 7 days a week, 365 days a year to manage the network infrastructure and oversee top-of-the-line servers that host our clients’ critical sites and services.



About ASPHostPortal.com

We’re a company that works differently to most. Value is what we output and help our customers achieve, not how much money we put in the bank. It’s not because we are altruistic. It’s based on an even simpler principle. "Do good things, and good things will come to you".

Success for us is something that is continually experienced, not something that is reached. For us it is all about the experience – more than the journey. Life is a continual experience. We see the Internet as being an incredible amplifier to the experience of life for all of us. It can help humanity come together to explode in knowledge exploration and discussion. It is continual enlightenment of new ideas, experiences, and passions


Author Link


Corporate Address (Location)

ASPHostPortal
170 W 56th Street, Suite 121
New York, NY 10019
United States

Sign in