In dotnet intserfaces are
used for describing behaviour.
WCF,Web Service and
remoting this all technology uses RPC(Remote Procedure Calling) behaviour.
Abtract class not used
because class not support multiple interface.
In WCF rules, If a clas has been marked with a
ServiceContract attribute then another class cannot inherite from it.
Example:-
Just make a simple service
for adding and subtracting nos.
[ServiceContract]
Public abstract class
MathAbstract
{
[OperationContract]
Public Abstract Int Substract(int num1,int num2);
[OperationContract]
Public Abstract Int Add(int num1,int num2);
}
Public Class Math:MathAbstract
{
public Override int
Add(int num1, int
num2)
{
return num1 + num2;
}
public Override int
Subtract(int num1, int
num2)
{
return num1 - num2;
}
}
Please run this service
then you will get the following error :-
"The service class of
type Service both defines a ServiceContract and inherits a ServiceContract from
type IService. Contract inheritance can only be used among interface
types. If a class is marked with ServiceContractAttribute,
then another service class cannot derive from it."
Note: This content has taken from different blogs or post.
No comments:
Post a Comment
Note: only a member of this blog may post a comment.