Click here to Skip to main content
15,881,424 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi all
i have group of academies and manages received data in central office by a wcf service ,received data is as followed:
Teacher info :new teacher ,update teacher and delete teacher ,...
student info :new student ,update student and delete student ,...
...

1- does it need to split in separate service?
2- how and can i combine service address in App.config file of service host app to client use my services in single add service reference?

i.e this is my service contract:
C#
[ServiceContract]
public interface ITeacher
    {
        [OperationContract]
        void Add(Teacher teacher);
        [OperationContract]
        void Update(Teacher teacher);

        [OperationContract]
        void Delete(Teacher teacher);
    } 
[ServiceContract]
public interface IStudent
        {
            [OperationContract]
            void Add(Student student);
            [OperationContract]
            void Update(Student student)
            [OperationContract]
            void Delete(Student Student);
        }


XML
<system.serviceModel>
    <services>
      <service name="BusManagmentService.StudentService">

        <endpoint address="" binding="basicHttpBinding" contract="BusManagmentService.IStudent">
          <identity>
            <dns value="localhost" />
          </identity>
        </endpoint>

        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
        <host>
          <baseAddresses>
            <add baseAddress="http://localhost:8733/BusManagmentService/IStudent/" />
          </baseAddresses>
        </host>
      </service>
      <service name="BusManagmentService.TeacherService">
        <endpoint address="" binding="basicHttpBinding" contract="BusManagmentService.ITeacher">
          <identity>
            <dns value="localhost" />
          </identity>
        </endpoint>
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
        <host>
          <baseAddresses>
            <add baseAddress="http://localhost:8733/BusManagmentService/ITeacher/" />
          </baseAddresses>
        </host>
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior>
          <!-- To avoid disclosing metadata information,
          set the values below to false before deployment -->
          <serviceMetadata httpGetEnabled="True" httpsGetEnabled="True"/>
          <!-- To receive exception details in faults for debugging purposes,
          set the value below to true.  Set to false before deployment
          to avoid disclosing exception information -->
          <serviceDebug includeExceptionDetailInFaults="False" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
  </system.serviceModel>
Posted
Comments
Raul Iloc 16-Dec-14 3:00am    
Did you tried one of the options that I suggested in my solution?

1 solution

1.You do not need to split them. You should have only one class, all method should return an error code (for database errors) and you should rename the method like this:
C#
int AddTeacher(Teacher teacher);

2.Your 2nd question will be automatically solved if you will do like I suggested above.

3.There is also the possibilities to define and use Multiple Service Contracts, but in your case is not indicated. For details about this see the next article: http://www.c-sharpcorner.com/uploadfile/dhananjaycoder/multiple-service-contracts-in-wcf-service/[^]
 
Share this answer
 
v2

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