views:

27

answers:

2

I have two distinct databases as a source for a Silverlight RIA application. They are exposed through separate RIA services.

There is one relationship between the databases, meaning that I have a foreign key (no constraint) between the databases. My Entities currently load this as an Int32. How would I go about mapping this to an actual end-user display value from the other database?

It appears that Value Converters require synchronous operations. Also, any asynchronous call in the DomainDataSource.LoadedData will cause the data source to remain busy indefinitely.

A: 

Depending on the details of your scenario you could create either a view or a stored procedure in one database that will run your query across both databases and return a single result set.

You can then get RIA Services to return the results of the view/stored procedure...

That way you are only making a single call from Silverlight...

Scrappydog
+1  A: 

You could also consider using the ExternalReference attribute.

For example,

public partial class SalesOrderHeader
{
   [ExternalReference]
   [Association("My_Custom_FK", "CustomerID", "CustomerID")]
   public Customer Customer { get; set; }
}

In this way you could build a connection between your RIA domain contexts. An example that helps towards making this work is Nikhil's BookClub solution where he projects domain entity types into objects he returns to his view models.

You could do the same except you would be bridging the gap between domain contexts.

Rus
Exactly what I was looking for! Thanks for the reply.
JHappoldt