Print Page | Close Window

Multiple Databases, Different Locations

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce 2010
Forum Discription: For .NET 4.0
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=3389
Printed Date: 13-May-2026 at 8:27am


Topic: Multiple Databases, Different Locations
Posted By: Lemispaid
Subject: Multiple Databases, Different Locations
Date Posted: 11-Apr-2012 at 11:01pm
Devforce 2010 Universal

Hi there, I have an interesting scenario that's I'm struggling with. We have a Silverlight app that uses 2 separate databases. The app predominantly uses a small sql database, but it also needs access a larger sql database hosted at a different location. Therefore, I've got my project setup with two Entity Models and two Entity Managers which works fine, however, I need to be able to change the EndPoint on one of the Managers once a user logs in because we'll then know the location of the Entity Service (BOS) running on a clients own IIS server. 

I've tried implementing my own ServiceProxyEvents and this isn't working as expected. 

In a nutshell the app gets its data from two different BOS but I can't seem to get this working? Any ideas appreciated... 

Regards




Replies:
Posted By: sbelini
Date Posted: 12-Apr-2012 at 3:40pm
Hi Lemispaid,
 
Can you explain in detail what you are trying to accomplish? Are you trying to connect to one BOS and then connect to another?
 
Also, have you taken a look in the DevForce Resource Center at:
http://drc.ideablade.com/xwiki/bin/view/Documentation/connect-to-multiple-entityservers - http://drc.ideablade.com/xwiki/bin/view/Documentation/connect-to-multiple-entityservers
http://drc.ideablade.com/xwiki/bin/view/Documentation/multiple-entityservers - http://drc.ideablade.com/xwiki/bin/view/Documentation/multiple-entityservers
 
Regards,
   Silvio.


Posted By: Lemispaid
Date Posted: 12-Apr-2012 at 8:41pm
Thanks Silvio, let me try to explain.

We have an application that allows employees to create timesheets online in an ASP.Net application, I'm currently porting to Silverlight. The application itself will be hosted on Azure and get the majority of it's data from an online Azure database. However, the application will also get data from our clients accounting package so we currently have a Web Service running on our clients own IIS servers that has relevant methods for reading and writing back to the accounting package. I'm wanting to get rid of the Web Service and replace with a Devforce BOS.

Therefore, when an employee logs into the Silverlight App, they belong to a Tenant (multi tenanted database) and the Tenant will have a URL to their own IIS server hosting the Devforce BOS. Sorry that's the best way to explain it :)

Therefore, we have two Entity Managers, one will be static and be the same address, the other will be dynamic and require a different endpoint based on who logs in. 

Hope that helps. In the meantime, I'll take a look at the links you've provided.

Regards
Lemispaid


Posted By: Lemispaid
Date Posted: 16-Apr-2012 at 6:17pm
Hi Guys,

A quick update, after looking at the links you provided I was able to achieve what I wanted by placing <objectServer> in the app.config in the Silverlight Shell and by setting its Build Action to Embedded Resource.  Thanks for your help...

Regards


Posted By: Lemispaid
Date Posted: 17-Apr-2012 at 10:54pm
Sorry guys, I jumped the gun a little. It seems that my previous post resolved merely the ability to define multiple objectServers in the App.Config. When I try to log into the second EntityManager with the address I specify in the file, I get the following error;

"System.ServiceModel.CommunicationException: The remote server returned an error: NotFound"

Now I can resolve the service using  http://localhost:9100/EntityService.svc - http://localhost:9100/EntityService.svc  it's running as expected. My App.Config is as follows;

<configuration>
  <ideablade.configuration version="6.00" xmlns="http://schemas.ideablade.com/2010/IdeaBladeConfig" >
    
    <objectServer remoteBaseURL="http://localhost" serviceName="EntityService.svc" serverPort="9010">
      <clientSettings isDistributed="true"/>
      <serviceKeys>
         <serviceKey name="westvic" remoteBaseURL="http://localhost" serviceName="EntityService.svc/sl" serverPort="9100"/>
      </serviceKeys>
    </objectServer>
    
  </ideablade.configuration>
</configuration>

I have clientaccesspolicy.xml in place, that resolved an earlier error, but I simply can't work out how to get this working after spending at least 15 hours trying to resolve it. Here's some extra info from fiddler;

#ResultProtocolHostURLBodyCachingContent-TypeProcessCommentsCustom
13200HTTPlocalhost:9010/EntityServer.svc/sl18,678private application/x-gzipiexplore:7652
14200HTTPlocalhost:9010/EntityServer.svc/sl1,206private application/x-gzipiexplore:7652
15200HTTPlocalhost:9010/EntityServer.svc/sl961private application/x-gzipiexplore:7652
16200HTTPlocalhost:9010/EntityService.svc/sl267private application/x-gzipiexplore:7652
17200HTTPlocalhost:9100/clientaccesspolicy.xml335private text/xmliexplore:7652
18500HTTPlocalhost:9100/EntityServer.svc/sl0private iexplore:7652
19200HTTPlocalhost:9010/EntityService.svc/sl135private application/x-gzipiexplore:7652
20500HTTPlocalhost:9100/EntityServer.svc/sl0private iexplore:7652
21200HTTPlocalhost:9010/EntityService.svc/sl135private application/x-gzipiexplore:7652

Regards



Posted By: Lemispaid
Date Posted: 18-Apr-2012 at 10:51pm
OK, a little more on this. I created a Console app that successfully connects to the BOS and queries the data fine. It seems that once this occurs the Silverlight app can then connect and query fine. The debug log on the server initially only shows that it's listening for the EntityService.svc but not the EntityServer.svc. It's not until I run the console app that both are listening, then the silverlight app can login and use it. It's like the Silverlight login doesn't initialize the EntityServer? I'm confused? 

I remember reading something that said the EntityServer is available after the EntityService? Any help greatly appreciated...

Regards


Posted By: sbelini
Date Posted: 18-Apr-2012 at 11:30pm
Hi Lemispaid.
 
Were you initially trying to run on Cassini?
You should be using IIS as Cassini won't support this.
 
Regards,
   Silvio.


Posted By: Lemispaid
Date Posted: 19-Apr-2012 at 3:45pm
Hi Silvio, I'm using IIS and also have it running in my dev environment...

Regards


Posted By: Lemispaid
Date Posted: 07-May-2012 at 12:23am
Hi Guys, 

It's been a while, and I've spent far too long on this issue so I've put a very basic standard Northwind demo app together that illustrates the problem of using multiple entity managers from different locations in a Silverlight application. The sample app is simply an addition to the basic Devforce getting started app. I'm using Devforce 2010 v 6.1.0. Please re-read previous posts on this issue, I now think it's a Devforce bug? Please prove me wrong!!

I really hope that by looking at the code, you'll see an obvious oversight, I've tried every combination of config file tweak under the sun. PLEASE PLEASE PLEASE help me resolve this issue, it's the only thing stopping the business that I work for buying a Devforce License....

http://www.ideablade.com/forum/uploads/1223/SilverlightApplication2Web.zip

Regards




Posted By: sbelini
Date Posted: 07-May-2012 at 8:50am
Thanks for the repro. I am checking it now.
 
Silvio.


Posted By: Lemispaid
Date Posted: 07-May-2012 at 4:52pm
Hi Silvio,

Have you had any luck?

Regards
Marcus


Posted By: sbelini
Date Posted: 07-May-2012 at 6:14pm
Hi Marcus,
 
I did find an error, but not the error you stated.
The good news is that the issue I saw in DevForce6.1.0 is not present in DevForce6.1.7 and in the latter I was able to run the application with no issues.
 
One thing to be aware of is that you will need the client access policy and cross domain xml files in your wwwroot directory in order to avoid Silverlight Cross Domain errors. (more info on that at http://forums.silverlight.net/t/63112.aspx - http://forums.silverlight.net/t/63112.aspx )
 
Regards,
   Silvio.


Posted By: Lemispaid
Date Posted: 07-May-2012 at 7:03pm
Hi Silvio,

Thanks for checking in the newer version, I'll update and see if the problem disappears...I do have the cross domain xml files in our production app just forgot to put them in the sample app. Cheers...

Regards
Marcus


Posted By: Lemispaid
Date Posted: 07-May-2012 at 10:11pm
Hi Silvio,

Wahoo....I can confirm it's fixed and working fine in 6.1.7.....Thanks

Regards
Marcus



Print Page | Close Window