Adapter Usage

I am using an adapter in many loops.

PartAdapter adapterPart = new PartAdapter(this.oTrans);
adapterPart.BOConnect();
//logic
adapterPart.Update();
adapterPart.Dispose();

Do I need to dispose after every operation and reinitialize the part adapter or what?

I’m getting an Object not set to an instance of an object (and I believe this is the issue)

private PartAdapter  adapterPart ;
public void InitializeCustomCode()
	{
		this.adapterPart = new PartAdapter(this.oTrans);
        this.adapterPart.BOConnect();
	}

	public void DestroyCustomCode()
	{
		// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Object Disposal' lines **
		// Begin Wizard Added Object Disposal

		if ((this.adapterPart != null))
		{
			this.adapterPart.Dispose();
			this.adapterPart = null;
		}
	}
2 Likes

thank you… testing now