Send Dbcontext to the internal method being scrapped

First off - apologies if this is trivial. I've done some searching but can't find anything specifically relevant. Almost all of the questions I've found have concerned nested using statements - which does not apply in my case. The problem: I have a m

How to use dispose () correctly?

For example, if I have an instance of an object, which implements Disposable, let's say it is BitmapFont someFont = new BitmapFont(); According to LibGDX documentation, I should call the dispose() method as soon as the object is no longer needed. But

Blocking the call when you discard MainForm in FormClosing

I have an issue that relates to threading, cleaning up unmanaged resources and shutting down my app. In the main UI thread I have a method that creates a new instance of class Worker. In Worker's constructor I start a new thread that has a while(Scan

How to have a SWT font set on a Draw2D label?

In a GEF editor, I have the following EditPart: public class MyLabelEditPart extends AbstractGraphicalEditPart { @Override protected IFigure createFigure() { return new Label(); } @Override protected void refreshVisuals() { MyModel model = (MyModel)

SPDisposeCheck tells me not to have a Sharepoint website

using (var web = SPContext.Current.Site.RootWeb) { //Some code } The SPDisposeCheck tool is telling me not to dispose of this object - but I thought this was a prime example of where you should dispose of an SP object!? Output from SPDisposeCheck: No

Does userControl1.Dispose () take care of all its disposables?

i have made a userControl library .. and it contains NetworkStream, StreamReader, FileStream So do i have to Dispose them all when the form that has this userControl closes ?? I mean There's no such Form1_FormClosing(object sender,FormClosingEventArg

Should SqlTransaction have Dispose called?

Do I need to call dispose in the finally block for SqlTransaction? Pretend the developer didnt use USING anywhere, and just try/catch. SqlTransaction sqlTrans = con.BeginTransaction(); try { //Do Work sqlTrans.Commit() } catch (Exception ex) { sqlTra

How can I get a prototype in JS?

I've got a thorny issue and although the answer may be obvious, I cannot see how to do what I'm trying to do. I have created a script library for my application that uses JS prototypes and templating to dynamically instantiate DOM elements AND to wir

Trying to unload third-party unmanaged and managed DLLs

Can you tell me please what is the best way to make garage collector to unload unmanaged/managed third party dlls.There is no way to unload managed assembly in .NET. The only option is to unload the entire AppDomain. See also: Unloading an Assembly -

Two questions about Dispose () and the destructors in C #

I have a question about how to use Dispose() and destructors. Reading some articles and the MSDN documentation, this seems to be the recommended way of implementing Dispose() and destructors. But I have two questions about this implementation, that y

How to dispose of resources with dependency injection

I'm using StructureMap to resolve references to my repository class. My repository interface implements IDisposable, e.g. public interface IMyRepository : IDisposable { SomeClass GetById(int id); } An implementation of the interface using Entity Fram

Is FileStream.Dispose sufficient?

I'm using the FileStream and StreamReader classes like so: using(FileStream stream = File.Open(filePath,FileMode.Open,FileAccess.Read,FileShare.ReadWrite)) { using(var reader = new StreamReader(stream)) { content = reader.ReadToEnd(); } } This means

Should I throw the socket manually after closing?

Should I still call Dispose() on my socket after closing it? For example: mySocket.Shutdown(SocketShutdown.Both); mySocket.Close(); mySocket.Dispose(); // Redundant? I was wondering because the MSDN documentation says the following: Closes the Socket

When should I use features () on the charts?

I'm learning to draw stuff in C# and I keep seeing recommendations to use dispose(), but I don't quite understand what it does. When should I be using dispose() on a code-drawn graphic? What happens if I don't? Do I need to call it every time a graph

Should I call Dispose () in a function after the return?

Should I call .Dispose() after returning an object that implements IDisposable? myDisposableObject Gimme() { //Code return disposableResult; disposableResult.Dispose(); } In other words, is the object I return a copy, or is it the object itself? Than

Implement Dispose or Finalize?

Class ComponentsContainer ' a component contains other components' Inherits System.ComponentModel.Component Private foo as New Component Private bar as New Component Protected Override Sub Finalize() foo.Dispose() ' HERE ? ' bar.Dispose() MyBase.Fina

Correct cleaning of WPF user controls

I am relatively new to WPF, and some things with it are quite foreign to me. For one, unlike Windows Forms, the WPF control hierarchy does not support IDisposable. In Windows Forms, if a user control used any managed resources, it was very easy to cl

How to guarantee a NotifyIcon disappears?

I'm using a NotifyIcon control in one of my child (modal) forms and it is working fine. SHowing balloon tips as expected, handling mouse events etc... It doesn't however vanish when I would expect it to. Specifically, when i exit the child form and t