Hi All,
I am new to Web/WCF/Services - so bear with me :)
I am trying to analyse the code-flow in a .NET application but I have a hard time understanding the reasoning behind using the following approach when it comes to exposing services :
Now, in the application, I have a C# Class Lib Proj which has a C# Class Library project called "XXX.YYY.Services " within which I have 2 files :
ISomeServiceProviderClass.cs SomeServiceProviderClass.cs
Within the ISomeServiceProviderClass.cs I have the following structure for code :
[ServiceContract]
public interface ISomeServiceProviderClass
{
[OperationContract]
int SomeFunc();
}
Then there is the SomeServiceProviderClass.cs class which is defined like so :
public class SomeServiceProviderClass: ISomeServiceProviderClass
{
public int SomeFunc()
{
/// some code to do the implementation..
}
}
This is a sample service structure in my Provider Application. Obviously the Consumer application is using this service to show results in its UI layer.
Now I want to know, what is the need to have the interface called ISomeFile.cs and then SomeFile.cs which implementes this interface ?
I guessed that one of the reasons could be to allow for different types of implementations in each of the class that implements this interface ... If that is the case, then why not have just a SomeServiceClass.cs file within which I have Virtual functions that can be overridden in derived classes ? Or why not have an Abstract class with abstract functions ?