In our project we are making WCF calls using the following Code.
// In generated Proxy we have..
public static ICustomer Customer
{
get
{
ChannelFactory<ICustomer> factory = new ChannelFactory<ICustomer>("Customer");
factory.Endpoint.Behaviors.Add((System.ServiceModel.Description.IEndpointBehavior)new ClientMessageInjector());
ICustomer channel = factory.CreateChannel();
return channel;
}
}
and we have Service Proxy class which has the methods like
public static Datatable GetCustomerDetails(int id)
{
return Services.Customer.GetCustomerDetails(id);
}
public static void .SaveCustomerDetails (int id)
{
Services.Customer.SaveCustomerDetails(id) ;
}
etc... which we use to make business calls.
Recently we found out that we need to "Close" the wcf connection and we are trying to find out away to do this without asking our developers to change too much of their code.
Please provide us with some suggestions which would help us achieve this goal