Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3595390
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T19:50:44+00:00 2026-05-18T19:50:44+00:00

As a Silverlight newbie, I am finding it really hard to set up an

  • 0

As a Silverlight newbie, I am finding it really hard to set up an RIA Web service. The examples available on the web almost always refer to Entity framework as the ORM but we are using NHibernate as our ORM. I am aware of the tutorial by Brad Abrams where he uses NHibernate as the ORM but most of it goes above my head because I am also a newbie at NHibernate and some of the concepts of RIA are not clear to me e.g. DomainService.

I’d like to first keep it simple and ignore the ORM at the moment. So, can anyone point me in the right direction as to how to get a “vanilla” web service going with Silverlight 4.0 and the latest release of RIA? For instance, how would I expose a method which returns the integer 100 and then call the method from my SilverLight application? Also, I am not sure if it’s relevant or not but the Silverlight application is hosted in ASP.NET MVC 2.

To me it should be so simple but I’m really struggling with it at the moment.

TIA,

David

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T19:50:44+00:00Added an answer on May 18, 2026 at 7:50 pm

    These scenarios (non-EntityFramework RIA Services with Silverlight) are definitely under documented and I hope to post some blog entries soon to cover these scenarios (including how to use NHibernate).

    Here is one way to do what you are asking:

    Install “Silverlight 4 Tools for Visual Studio 2010” if you haven’t already:

    http://www.microsoft.com/downloads/en/details.aspx?FamilyID=b3deb194-ca86-4fb6-a716-b67c2604a139&displaylang=en

    Create a new Silverlight Navigation Application in Visual Studio 2010 (check the box to enable RIA Services).

    Modify the web.config in the web project in the following ways:

    In the <system.web> section, add:

    <httpModules>
      <add name="DomainServiceModule"
       type="System.ServiceModel.DomainServices.Hosting.DomainServiceHttpModule,
             System.ServiceModel.DomainServices.Hosting, Version=4.0.0.0,
             Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    </httpModules>
    

    Add a <system.serviceModel> section as a peer of <system.web>:

      <system.serviceModel>
        <serviceHostingEnvironment aspNetCompatibilityEnabled="true"
         multipleSiteBindingsEnabled="true" />
      </system.serviceModel>
    

    Add the following references to the web project:

    System.ServiceModel.DomainServices.Hosting  
    System.ServiceModel.DomainServices.Server
    

    Create a new class VanillaDomainService in the web project that contains your “return 100” method:

    [System.ServiceModel.DomainServices.Hosting.EnableClientAccess()]
    public class VanillaDomainService :
                    System.ServiceModel.DomainServices.Server.DomainService
    {
        public int ReturnInteger100()
        {
            return 100;
        }
    }
    

    Now back to the Silverlight Application project, in Home.xaml.cs, in the OnNavigatedTo method, call your new RIA Services method (remember all calls are async):

        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            SilverlightApplication1.Web.VanillaDomainContext oneVanillaDomainContext =
               new SilverlightApplication1.Web.VanillaDomainContext();
    
            oneVanillaDomainContext.ReturnInteger100(
               anInt => MessageBox.Show(anInt.Value.ToString()), null);
        }
    

    Now build and run and that should be it.

    I tested this code and it worked for me.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm a newbie to Silverlight and I'm having some trouble finding a solution to
Silverlight has been available since quite some time, and Silverlight 2 allows .Net programming
Silverlight newbie question: I've got a small Silverlight application with the following XAML snippet:
I'm a Silverlight newbie. Just downloaded version 3.0 after the Mix announcement. I'm running
I've been trying to find a good advanced Silverlight 4 course, but can't really
Newbie question... I am using silverlight to POST data to my GAE application class
Silverlight works on client side so putting any sensitive data like connection strings, passwords
Silverlight v2.0 is getting closer and closer to RTM but I have yet to
Could Silverlight be used for the same things as jQuery, or are they intended
In Silverlight how can I launch / navigate to another page?

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.