Upgrading from .NET RIA Services to WCF RIA Services

So the new WCF RIA Services are here for Visual Studio 2008 SP1, and with that the older applications created with the preview .NET RIA Services back in July need a few work to be updated. If you created any application using the templates that came with .NET RIA Services like the Navigation template of the Business Application Template, there are a few things you need to do to upgrade to the new WCF RIA Services.

replace all instances of RiaContext as became WebContext.

The Context become DataContext also.

The App.xaml need to change from

 <Application.ApplicationLifetimeObjects>
        <app:RiaContext>
            <app:RiaContext.Authentication>
                <appsvc:FormsAuthentication/>
                <!--<appsvc:WindowsAuthentication/>-->
            </app:RiaContext.Authentication>
        </app:RiaContext>
    </Application.ApplicationLifetimeObjects>

 

to

 <Application.ApplicationLifetimeObjects>
        <app:WebContext>
            <app:WebContext.Authentication>
                <appsvc:FormsAuthentication/>
                <!--<appsvc:WindowsAuthentication/>-->
            </app:WebContext.Authentication>
        </app:WebContext>
    </Application.ApplicationLifetimeObjects>
 
Logout method on LoginControl.xaml.cs change from
 private void LogoutButton_Click(object sender, RoutedEventArgs e)
        {
            _authService.Logout();
        }

to

 private void LogoutButton_Click(object sender, RoutedEventArgs e)
        {
            this.authService.Logout(logoutOperation =&gt;
            {
                if (logoutOperation.HasError)
                {
                    ErrorWindow.CreateNew(logoutOperation.Error);
                    logoutOperation.MarkErrorAsHandled();
                }
            }, /* userState */ null);
        }
 

Hope this helps.

Cheers

Al

No Comments