JD.
JD.

Reputation: 15551

Where to put configuration information in Silverlight?

I am using prism and have a number of modules. In several of them I am making webservice and wcf calls. I want to be able to configure the information about these services in one place. Should I do this in a resources.resx file? I remember a settings.setting file but that was in a web application.

JD

Upvotes: 2

Views: 328

Answers (3)

Bill
Bill

Reputation: 2372

What you can do is the following:

  1. In the Bootstrapper application, add a reference to that WCF
  2. Create your own custom proxy class imlpementing an interface that dictates the methods to be called
  3. Register this IProxy with Unity Container, then pass to each of your ViewModels an IProxy parameter. Unity will do the job by injecting the real instance of that IProxy.

This way you have based all the WCF connection in one place.

Does it help?

Regards

Upvotes: 0

Dan Auclair
Dan Auclair

Reputation: 3617

When you create service reference in a Silverlight Application, it should automatically generate a ServiceReferences.ClientConfig XML file and put it in your project. It will put the binding and endpoint config info in this file. If you create an instance of your service proxy object without specifying any binding/endpoint it will use the info from the file.

Upvotes: 2

user195488
user195488

Reputation:

You can put it in the app.config or you can follow this blog on passing server information to the Silverlight client.

Silverlight Bits&Pieces has this piece on Silverlight configuration options.

Upvotes: 4

Related Questions