I have a subclassed ListBox
with the following property:
Property Query As Func(Of IEnumerable)
this i use all over like this
MyListBox.Query=Function() MyDBContext.Products
or
MyListBox.Query=Function() MyDBContext.Clients.Where(function(x) x.Age>25)
etc
I now see that the way I use the Query
property all over, never disposes of the MyDBContext, since I'm not using Using
so the question is:
Is there a way in my ListBox to grab only the function part of the func (i.e. .Clients.Where(function(x) x.Age>25)
and apply it to a different dbcontext that i will use and dispose of internally in MyListBox
?
Thank you very much
Aucun commentaire:
Enregistrer un commentaire