WCF (REST) and Unity - Objects Don't Get Recycled

Apr 8, 2010 at 7:13 AM

Hi Folks!

I have following issue with my WCF (REST) service that uses the Unity framework for IOC / DI:

I implemented a service (.svc) that has a reference / dependency to an object that handles the business logic (different assembly) which does also has dependency to the data access 'layer' which actually is a class in a separate assembly.

From the test client I request data from the service as following:

using (WebChannelFactory<IFundService> wcf = new WebChannelFactory<IFundService>("HttpFundServiceEndPoint"))
{
                wcf.Open();
                IFundService fsvc = wcf.CreateChannel();
                SingleValue sv1 = fsvc.GetValue("Avalon", "CommitmentsTransaction", DateTime.Now);
                SingleValue sv2 = fsvc.GetValue("Avalon", "CommitmentsTransaction", DateTime.Now);
                wcf.Close();
}

 

As you can see I do the same call twice with the result that the numeric values get summed up e.g. the Total value is doubled after the second call.
Can anybody tell me how I can avoid such a behavior? How can clean up the cache of the "business layer" object?

Thank you for your help!
Dam

Apr 8, 2010 at 3:04 PM

Hi Dam,

You may get a better response to this by using a project's discussions or the MSDN forums. This discussion list is for the CodePlex site itself.

Thanks,
Matt