Click here to Skip to main content
15,887,335 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi All,

Calculated properties work fine when the WCF RIA Services are created under the web page that hosts the Silverlight application. However, I cannot figure out why computed properties do not work with WCF RIA Services Class Library (everything else works fine with WCF RIA Services Class Library).

Please provide advice to solve this issue. I greatly appreciate your advice.

Thanks in advance,

Luis Nambiar


A small example of what I have is shown below.

1.- This is the metadata generated in the WCF RIA Services Class Library called ‘ClientsSetUpRiaLib’:

namespace ClientsSetUpRiaLib.Web
{
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Data.Objects.DataClasses;
using System.Linq;
using System.ServiceModel.DomainServices.Hosting;
using System.ServiceModel.DomainServices.Server;


[MetadataTypeAttribute(typeof(ClientContact.ClientContactMetadata))]
public partial class ClientContact
{
internal sealed class ClientContactMetadata
{
private ClientContactMetadata()
{
}
public string LastName { get; set; }
public string PhoneNumber { get; set; }
}
}
}
2.- This is the calculated property in file ‘Class1.cs’
using System.ServiceModel.DomainServices.Client;

namespace ClientsSetUpRiaLib.Web
{
public partial class Client : Entity
{
public int No { get; set; }
}
}

3.- This is the code in the MainPage.xaml.cs
using System;
using System.Windows;
using System.Windows.Controls;
using ClientsSetUpRiaLib.Web;

namespace SilverlightApplication2
{
public partial class MainPage : UserControl
{
public AdminDomain toContext = new AdminDomain();

public MainPage()
{
InitializeComponent();
}

public void LoadClients(bool UploadThisTableOnly)
{
LoadOperation<client> loadOpClient = toContext.Load(toContext.GetClientsQuery(),LoadBehavior.RefreshCurrent, false);

}

}
}

4.- These are the warning and error I get:

WARNING:
The type ‘ClientsSetUpRiaLib.Web.Client’ in ‘c:\BegASPNET\ezto\SilverlightApplication2\Class1.cs’ conflicts with the imported type ‘ClientsSetUpRiaLib.Web.Client’ in ‘c:\BegASPNET\ezto\ClientsSetUpRiaLib\Bin\Debug\ClientsSetUpRiaLib.dll’. Using the type defined in ‘c:\BegASPNET\ezto\SilverlightApplication2\Class1.cs’.

ERROR:
“Cannot implicitly convert type ‘System.ServiceModel.DomainServices.Client.LoadOperation<clientssetuprialib.web.client>[c:\Program Files (x86)\Microsoft SDKs\RIA Services\v1.0\Libraries\Silverlight\System.ServiceModel.DomainServices.Client.dll]’ to ‘System.ServiceModel.DomainServices.Client.LoadOperation<clientssetuprialib.web.client>[c:\Program Files (x86)\Microsoft SDKs\RIA Services\v1.0\Libraries\Silverlight\System.ServiceModel.DomainServices.Client.dll]’
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900