In our project, we make WCF calls using the following code.
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 a Service Proxy class that has methods such as
public static Datatable GetCustomerDetails(int id)
{
return Services.Customer.GetCustomerDetails(id);
}
public static void .SaveCustomerDetails (int id)
{
Services.Customer.SaveCustomerDetails(id) ;
}
etc. that we use to make business calls.
We recently found out that we need to “close” the wcf connection, and we are trying to figure it out without asking our developers to change their code too much.
Please provide us with some suggestions that will help us achieve this goal.
Developer
source
share