Sunday, May 6, 2012

Method Overloading in WCF

[ServiceContract]
public interface IGetEmployee
{
    [OperationContract(Name = "GetEmployeeDetailsById")]
    List GetEmployeeDetails(int id);

    [OperationContract(Name = "GetEmployeeDetailsByName")]
    List GetEmployeeDetails(String name);
}


     we can achive the method overloading through the name attribute of the operation contract set the alias name for the method .method name will appear based on the proxy class generation If you use the proxy class that is automatically generated by svcutility.exe, the alias method names will be used. However, you can manually edit the generated proxy class to achieve the appearance of overloaded methods on the client as well.This can be accomplished by applying the same attributes to the methods defined in the interface that is used by the proxy class.

Sunday, April 15, 2012

NVL2 function

The NVL2 function takes three arguments: NVL2 ( arg1, arg2, arg3 ) NVL2 returns arg3 if arg1 is NULL, and arg2 if arg1 is not NULL. The NVL function allows you to perform some value substitution for NULL values while the NVL2 function allows you to implement an IF..THEN...ELSE construct based on the nullity of data. For SQL Server we can uses the CASE statement. CASE WHEN arg1 IS NOT NULL THEN arg2 ELSE arg3 END this CASE statement will return arg3 if arg1 is NULL, and arg2 if arg1 is not NULL