Print Page | Close Window

Use EntitityService of Silverlight-App from local WPF App

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=2527
Printed Date: 04-Sep-2025 at 2:36am


Topic: Use EntitityService of Silverlight-App from local WPF App
Posted By: Andrew
Subject: Use EntitityService of Silverlight-App from local WPF App
Date Posted: 23-Feb-2011 at 3:23pm
Hi,
 
is it possible to connect to the EntityService of an existing Silverlight application?
The idea is to make a WPF application that uses this EntityService of an existing
Silverlight application for sharing the data within a local running application.
 
If it's possible, please give me some hints how to configure the WPF application
to get it work, cause I've tried already but it didn't work.
 
Thanks
Andrew



Replies:
Posted By: DenisK
Date Posted: 24-Feb-2011 at 1:45pm
Hi Andrew;

You should be able to connect to an existing Silverlight application entity service by changing the WPF application app.config file.

For example, if I have an existing WPF application called WpfApplication1, my current app.config will contain the following:

    <objectServer remoteBaseURL="http://localhost" serviceName="WpfApplication1/EntityService.svc">
      <clientSettings isDistributed="true" />
    </objectServer>

I have another Silverlight application called SilverlightApplication1 whose EntityService is located on the following address:

http://localhost/SilverlightApplication1/entityservice.svc

To allow my WpfApplication1 to connect to this SilverlightApplication1 EntityService, I just changed my WpfApplication1 app.config to the following:

    <objectServer remoteBaseURL="http://localhost" serviceName="SilverlightApplication1/EntityService.svc">
      <clientSettings isDistributed="true" />
    </objectServer>

If you have already tried this, could you give me more info as to how your existing Silverlight app is configured and deployed? Any additional info on what you have tried and didn't work will help as well.


Posted By: Andrew
Date Posted: 24-Feb-2011 at 2:01pm
Hi Denis,
 
thank you for your reply.
So I'm happy that it will work.
 
Then the next question is how to share the same entity model.
I would like to have one entity model that will be referenced from the silverlight and the wpf application.
Is this possible?
 
Can I have the same type of EntityManager from my entities then?
Which files do I have to reference?
 
Thank you
Andrew
 
 


Posted By: smi-mark
Date Posted: 24-Feb-2011 at 3:38pm
Hi Andrew,

The entity model you create on the web server is the one you use in WPF. If you currently have it inside the web project, and not as a separate, then you may want to think about having it structured like this:

MyModel.Desktop (Namespace MyModel)
     Edmx

MyModel.SL (Namespace MyModel)
     Linked Edmx


SL Application - Reference to MyModel.SL
Web Project - Reference to MyModel.Desktop
WPF Application - Reference to MyModel.Desktop



Print Page | Close Window