This project is read-only.

IDisposable support for Resources with QueryComposition

Topics: Web Api
Mar 22, 2011 at 9:46 PM

I think a common use of the QueryComposition attribute will be to return IQueryable implementations from existing ORMs like NHibernate or EF. If you do things like the code above,

public IEnumerable<Customer> GetAll()
return efContext.Customers;
You can not dispose the EF context in the same method, or otherwise the WCF pipeline will not able to use the IQueryable implementation. 
A solution for this will probably allow the developer to implement IDisposable at resource level, and make WCF to call the Dispose method to release things like the context in this case.