Click here to Skip to main content
15,892,965 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi I Have Error in my WCF app
i want to using a class in WCF application

.CS File

C#
namespace AccessService
{
  [ServiceContract]
    public interface IService1
    {

        [OperationContract]
        string GetData(int value);

        [OperationContract]
        string GetProvider(string IP, string Serial);

        [OperationContract]
        DatabaseProviderProp SendConnectionProv(DatabaseProviderProp Composite);

    }


 [DataContract]
    public class DatabaseProviderProp
    {

        string ServIP;
        string DbName;

        [DataMember]
        public string ServerIP
        {
            get { return ServIP; }
            set { ServIP = value; }
        }

        [DataMember]
        public string DatabaseName
        {
            get { return DbName; }
            set { DbName = value; }
        }

    }
}


.SVC.CS File

C#
namespace AccessService
{
    public class AccessServ : IService1
    {
        public string GetData(int value)
        {
            return string.Format("You entered: {0}", value);
        }

        public string GetProvider(string IP, string Serial)
        {
            ConnectionProviders ConProv = new ConnectionProviders();

            if (ConProv.CheckIP(IP) == true)
            {
                if (ConProv.SearchSerial(Serial) == true)
                {
                    return "Ok";
                }
                else
                {
                    if (ConProv.ExProperty == null)
                    {
                        return "Eror In Serial Or Your Requst IP";
                    }
                    else
                    {
                        return ConProv.ExProperty;
                    }
                }
            }
            else
            {
                if (ConProv.ExProperty == null)
                {
                    return "Eror In Serial Or Your Requst IP";
                }
                else
                {
                    return ConProv.ExProperty;
                }
            }
        }

        

        public  DatabaseProviderProp SendConnectionProv(string Serial)
        {
 			 DatabaseProviderProp Database = new DatabaseProviderProp();
            Database.DatabaseName = "Hi All";
            return Database;
        }
    }
}


Error In "AccessServ" Class
I do not want to add DatabaseProviderProp class in SendConnectionProv as parameter but when i do that error hide
i want to add a "Serial" as a parameter and the DatabaseProviderProp as variable

thanks...
Posted

1 solution

All interface members should always be implemented in the class implementing an interface. This is not related to WCF, this is how .NET is designed. (Thanks goodness; not having this error causes disaster.)

—SA
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900