Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 406
  • Last Modified:

Specify Oject Name in Silverlight Enabled WCF Service

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
farminsure
Asked:
farminsure
  • 2
1 Solution
 
Gautham JanardhanCommented:
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
 
farminsureAuthor Commented:
Is there a way to do this at the service level instead of object leve?
0
 
Gautham JanardhanCommented:
no.. i don't think so..my understanding is that it has to be done at the object level.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now