troubleshooting Question

WCF and Custom Entity Library

Avatar of regisdaniel
regisdaniel asked on
.NET ProgrammingC#WCF
2 Comments1 Solution442 ViewsLast Modified:
I´m building a WCF Service that will use a object that is defined on another project, called EntitiesPrj, that is part of the same solution.

On the EntityPrj, the class is declared as below:

    [Serializable()]
    public class ChartData
    {
        private string serieName;
        public string SerieName
        {
            get { return serieName; }
            set { serieName = value; }
        }

        private DateTime date;
        public DateTime Date
        {
            get { return date; }
            set { date = value; }
        }

        private bool workDay;
        public bool WorkDay
        {
            get { return workDay; }
            set { workDay = value; }
        }

        private decimal value;
        public decimal Value
        {
            get { return this.value; }
            set { this.value = value; }
        }

    }

And, on WCF Project, the method that use this Entity is declared as below:

    [ServiceContract]
    public interface IService1
    {

        [OperationContract]
        void GetChartData(ref EntityPrj.ChartData cData);

    }

    public class Service1 : IService1
    {

        public void GetChartData(ref EntityPrj.ChartData cData)
        {

            //Work with ChartData here...

        }

    }

Will I need to decorate my ChartData with the [DataContract] and its members with the [DataMember] attributes, even if this class is part of another project (another DLL) and used by other applications that do not use WCF?

Thanks a lot!
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 2 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros