Solved

Specify Oject Name in Silverlight Enabled WCF Service

Posted on 2010-09-17
3
377 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
HTTP Error 401.2 - Unauthorized IIS 7.5 1 120
Error while accessing webservices 1 70
return value async webservice 9 108
WCF proxy class doesn't include methods 8 84
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…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

856 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