Print Page | Close Window

Multiple databases from Silverlight

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce 2012
Forum Discription: For .NET 4.5
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=4208
Printed Date: 16-Apr-2025 at 5:03pm


Topic: Multiple databases from Silverlight
Posted By: rasmus
Subject: Multiple databases from Silverlight
Date Posted: 03-Jul-2013 at 5:34pm
Hi

Is this possible using a silvelight client?

http://drc.ideablade.com/xwiki/bin/view/Documentation/create-entitymanager-datasource-extension

When I add datasourceExtension to my login, Instead of the EM using another connection on the server, it tries connect to another EntityService_XXX. Is this by design?

I have also implemented a IDataSourceKeyResolver on the server, but no matter what I do, no keyExtension is passed to the implementation.

Hope you can help

Best regards,
Rasmus



Replies:
Posted By: kimj
Date Posted: 04-Jul-2013 at 7:34am
Data source extensions work the same with a Silverlight client as they do in other types of applications. Each extension results in a different EntityServer service URL, so you will see a URL like EntityServer_AA.svc for an "AA" extension. This extension is used to form the EdmKey/DbKey name used to resolve the connection string.

The extension should be passed as a parameter into the GetKey method in your IDataSourceKeyResolver. What are you seeing?


Posted By: rasmus
Date Posted: 04-Jul-2013 at 8:05am
Hi

Thank you for your reply

This parameter passed to the IDataSourceKeyResolver is blank no matter what i pass in as parameter from the client.

Best regards,
Rasmus


Posted By: kimj
Date Posted: 05-Jul-2013 at 10:20am
The data source extension needs to be passed into the EntityManager constructor. If you're providing it only as a LoginOption to the Authenticator then this isn't sufficient for the EM to use the extension when querying and saving.


Posted By: rasmus
Date Posted: 05-Jul-2013 at 11:00am
Hi

I have tried passing to the constructor. Can you confirm this to be working. I am running version 7.1.2 (Silverlight)

Best regards,
Rasmus


Posted By: kimj
Date Posted: 05-Jul-2013 at 11:29am
Yes, I can confirm this works in 7.1.2.

Are you registering the DevForce ServiceVirtualPathProvider in your global.asa application start logic? Have you implemented a custom ServiceProxyEvents or ServiceHostEvents? DevForce will use a separate EntityServer service for each data source extension, and gets that extension from the URL. If you're doing anything to modify the URL then that might be the problem.

DevForce can also be somewhat picky about the characters in the extension: "+", "-" and "_" characters can cause problems.


Posted By: rasmus
Date Posted: 05-Jul-2013 at 12:58pm
Hi

I do not use the ServiceVirtualPathProvider. I have “real” EntityServer.svc and EntityService.svc files, and for the extension (which is “Demonstration”) I have EntityServer_Demonstration.svc and EntityService_Demonstration.svc. I can confirm that the *.svc files are used by the client, just no parameters are transferred.

So if I understand you correctly, does this mean that the fact that I do not use ServiceVirtualPathProvider means that I am not able to transfer the parameters?

Can you show me a way to set up the ServiceVirtualPathProvider to be used instead of my physical EntityServer.svc and EntityService.svc files?

I would like if I could keep the URL for the services, and not have the "/sl" extension added.

Best regards,
Rasmus


Posted By: kimj
Date Posted: 05-Jul-2013 at 1:56pm
Your EntityServer_Demonstration.svc should contain the following:

<%@ServiceHost language=”C#”     
Service="IdeaBlade.EntityModel.Server.EntityServer, Demonstration"
Factory="IdeaBlade.EntityModel.Server.EntityServerHostFactory"
%>

You don't need an EntityService_Demonstration.svc.

There's more information on how to pass parameters to the service in the http://drc.ideablade.com/devforce-2012/bin/view/Documentation/code-sample-configuration-files#HIIS-relatedfiles - samples .


Posted By: rasmus
Date Posted: 05-Jul-2013 at 2:30pm
Hi

That did the trick :-)

Thanks,
Rasmus



Print Page | Close Window