Reputation: 9926
I have two different Interface service that I'm using
1. IService1
2. IService2
I define two files
1. IService1.cs => that hold the Interface of IService1
2. IService2.cs => that hold the Interface of IService2
I also define two different .cvs
1. IService1.cvs=> that hold the Interface of IService1
2. IService2.cvs=> that hold the Interface of IService2
Is OK to have this files struct or its better to have all the contract interface in one file and have one .cvs file ?
Upvotes: 0
Views: 530
Reputation: 364259
It is .svc file.
If you have two .svc files you are exposing two different services (two classes) where each has single endpoint, its own WSDL and its own behavior (like security, throttling, etc.).
If you have one .svc file the service must implement both interfaces (one class) and it will have two different endpoints described in the same WSDL with single service behavior.
I will skip the part where you manually modify .svc files to point to the same class because it has no real benefit and it will make things even more complicated (configuration is per service class not per .svc file).
So it really depends on what requirements do you have?
Upvotes: 1
Reputation: 81660
It depends.
If the implementation of IService1
and IService2
are in the same class:
public class MyService : IService1, IService2
{
...
}
Then one .svc file and you need two endpoints.
If they are in separate classes:
public class MyService1 : IService1
{
...
}
public class MyService2 : IService2
{
...
}
Then two .svc files.
Upvotes: 1