1

I have two DBs and I want to join data from both of them on same DataGrid:

  1. table Events from the first DB with fields Entry_Id and description
  2. table Details from the second DB with fileds Entry_Id, resolution

I am adding to my project two datamodels and two DomainService Class. How can I display the related data in one Datagrid and be able to edit the resolution field?

Thanks in advance

Avrum
  • 269
  • 2
  • 8
  • 16

2 Answers2

0

If they are on separate servers, perhaps consider using linked SQL server tables. See sp_addlinkedserver.

Otherwise, you can create a view on another database. See TSQL: Create a view that accesses multiple databases

Community
  • 1
  • 1
Chui Tey
  • 5,436
  • 2
  • 35
  • 44
  • Chui,Thanks for your answer. I already have a linked server. Create a new view may help me, I will verify – Avrum Aug 05 '12 at 14:23
  • Yes, this is the best solution since I do not have to update one of the DBs, so I bring data through linked server to my local DB and create a view, this is like having the two DBs on the same server – Avrum Aug 14 '12 at 13:42
0

DomainServices are all about providing Domain specific data for your application (by "Domain" they mean the area of business, rather than TLDs, which can lead to some confusion).

If your data was coming from two external services you would create a new data structure to hold the combined data and serve that to your application. That is no different to your situation of two databases so...

Your Domain service should be serving up the data your application wants/needs and no more. Create a class that has all fields you want/need and use LINQ to populate them from the two databases.

RIA is all about providing an easy way to map C.R.U.D. calls to methods. What you do in those methods is up to you, but the focus should be on the needs of the application and not what happens to be in the tables.

iCollect.it Ltd
  • 92,391
  • 25
  • 181
  • 202
  • Thanks, Magic. I will try to do this, my concern is that I have two diferent entityDataModels and two different DomainServices, I am not sure I will be able to join them on a single class.I will try it and I will let you know. I also found a walkthrought here: http://msdn.microsoft.com/en-us/library/ff422034(d=printer,v=vs.91).aspx . I will also try this solution. Thanks again – Avrum Aug 05 '12 at 14:15
  • @user995159: You only need a single DomainService to provide data from any number of databases/data models. – iCollect.it Ltd Aug 05 '12 at 17:54