I'm working on an asp.net-mvc application. The linq data context is being passed into my service objects by structure map. I've got is set to have a scope of hybrid. This all works just fine.
protected override void configure()
{
ForRequestedType<AetherDataContext>()
.TheDefaultIs(() => new AetherDataContext())
.CacheBy(InstanceScope.Hybrid);
}
The problem is that I keep running our of memory, I'm wondering if the IDisposable interface is ever actually being called.
Anyone got any ideas?
Failing that anyone got any other idea for things that might be causing my memory exceptions?
Update:
So some additional information, I just stuffed a couple of methods into my data context an put brake points in there.
protected override void Dispose(bool disposing)
{
Debug.WriteLine("Disposing: " + DateTime.Now.ToString());
base.Dispose(disposing);
}
public new void Dispose()
{
Debug.WriteLine("Disposing: " + DateTime.Now.ToString());
base.Dispose();
}
I'm not quite sure that I'm doing this the correct way, I'm guessing that the new method will be called?
Anyway, neither of the brake points were hit. However the constructor for the same class was called on every request though. Not ideal I'm thinking.