Solved

Specify Oject Name in Silverlight Enabled WCF Service

Posted on 2010-09-17
3
366 Views
Last Modified: 2012-05-10
In my Silverlight enabled WCF Service I have the following two methods GetCountyList and GetAdminCountyList (see attached code). The service appears to be naming the object County and County1. For usage in my View Model I would like to rename County1 to AdminCounty. How can I specify the object name in my service?
[OperationContract]

        public IList<County> GetCountyList(DateTime date)

        {

            IProductionManager manager = UnityManager.UnityContainer.Resolve<IProductionManager>();

            return manager.GetCountyList(date);

        }



        [OperationContract]

        public IList<Sdi.SharedObjects.Web.Objects.Entity.County> GetAdminCountyList()

        {

            IEntityManager entityManager = UnityManager.UnityContainer.Resolve<IEntityManager>();

            return entityManager.GetCountyList();

        }

Open in new window

0
Comment
Question by:farminsure
  • 2
3 Comments
 
LVL 29

Expert Comment

by:Gautham Janardhan
ID: 33704139
use the parameter "Name" in data contract.. this controls the name of the generated class at the client side
[DataContract(Name = "CompositeTypeGautham")]

    public class CompositeType

    {

        bool boolValue = true;

        string stringValue = "Hello ";



        [DataMember]

        public bool BoolValue

        {

            get { return boolValue; }

            set { boolValue = value; }

        }



        [DataMember]

        public string StringValue

        {

            get { return stringValue; }

            set { stringValue = value; }

        }

    }

Open in new window

0
 

Author Comment

by:farminsure
ID: 33716289
Is there a way to do this at the service level instead of object leve?
0
 
LVL 29

Accepted Solution

by:
Gautham Janardhan earned 500 total points
ID: 33717592
no.. i don't think so..my understanding is that it has to be done at the object level.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

In previous Articles, we have discussed how we can upload a file using .asmx web service and isolated storage space. Here, in continuation to the topic, I am going to discuss how we can use WCF for the same purpose. Steps: 1.Create the silverli…
While working on Silverlight and WCF application, I faced one issue where fault exception occurred at WCF operation contract is not getting propagated to Silverlight client. So after searching net I came to know that it was behavior by default for s…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now