title: How Can I guarantee that the Ninject will call the Disposable() automatically?
body: <p><strong>1)</strong> </p>
  
  <pre><code>public class DataProvider : IProvider , IDisposable{
  
         private SqlConnection connection = null;
         public DataProvider(string ConnectionString) {
              this.connection = new SqlConnection(ConnectionString);
             this.connection.Open();
         }
  
         public object GetUniqueData(SqlCommand CommandSql){}
  
         public void ExecuteInsertDeleteUpdate(SqlCommand CommandSql){}
  
         public void Dispose(){
            if (this.connection != null) {
                this.connection.Close();
                this.connection.Dispose();
            }
         }
  }
  </code></pre>
  
  <p><strong>2)</strong> </p>
  
  <pre><code>public class ManageBrandDAL : IManageBrandDAL {
  
        private IProvider provider = null;
  
        [Inject]
        public ManageBrandDAL (IProvider provider_){
             this.provider  = provider_;
        }
  
        public void RegisterBrand(string a_BrandName){
             SqlCommand SQLCommand =
                 new SqlCommand("INSERT INTO Brand(name) VALUES(@pm_brandname)");
             SqlParameter pm_brandname= new SqlParameter();
             pm_brandname.ParameterName = "@pm_brandname";
             pm_brandname.DbType = DbType.String;
             pm_brandname.Value = a_BrandName;
             SQLCommand.Parameters.Add(pm_brandname);
             this.provider.ExecuteInsertDeleteUpdate(SQLCommand);
         }
  </code></pre>
  
  <p><strong>3)</strong> </p>
  
  <pre><code>public class ModuleInfra : Ninject.Modules.NinjectModule
  {
        public override void Load(){
              Bind&lt;IProvider&gt;()
                  .To&lt;ProvedorDados()
                  .InTransientScope()
                  .WithConstructorArgument("ConnectionString", Manage.ConnectionString);
        }
  }
  </code></pre>
  
  <p>How can I guarantee that the Ninject Container will call the method <code>Dispose()</code> in <code>DataProvider</code> class after <code>ManageBrandDAL</code> uses the <code>DataProvider</code> object?</p>
  
  <p>Is the <code>InTransientScope()</code> the best lifecycle for this type of situation ? If not, what is more appropriate?</p>