Q:

Pass constructor with Ninject

I have one base generic repository and many class repository that inherits from the base repository. I need too pass string value to the generic repository.
Here is my Generic Repository
public class Repository<T> where T : EntityBase
    {
        private string SessionId;

        public Repository(string sessionId)
        {
            this.SessionId = sessionId;
        }

        protected virtual IDbConnection GetCn()
        {
            return new SqlConnection(ConfigurationManager.ConnectionStrings["SalesDb"].ConnectionString);
        }

        public virtual int Insert(T entity)
        {
            entity.ChUser = "anders.persson";
            entity.ChTime = DateTime.Now;

            using (IDbConnection cn = GetCn())
            {
                cn.Open();

                return cn.Insert(entity);
            }
        }

        // MORE CODE
        }
    }

And the interface
public interface IRepository<T>
{
    int Insert(T entity);

}

My Class Repository
public class MarketRepository : Repository<Market>, IMarketRepository
    {

    }

And the interface
public interface IMarketRepository : IRepository<Market>
{

}

Now i want to pass sessionId to the Generic Repositories constructor.
How can i do that. In this case i have to implement a constructor in every class repository and pass it to the base repository. And the interface dont even know about that constructor.
Here is the Ninject bindings
private static void RegisterServices(IKernel kernel)
{
    kernel.Bind(typeof(IRepository<>)).To(typeof(Repository<>));
    kernel.Bind<ILeadRepository>().To<LeadRepository>();
    kernel.Bind<IPricelistRepository>().To<PricelistRepository>();
    kernel.Bind<IOptionalGroupRepository>().To<OptionalGroupRepository>();
    kernel.Bind<IProductGroupRepository>().To<ProductGroupRepository>();
    kernel.Bind<IProductRepository>().To<ProductRepository>();
    kernel.Bind<IMarketRepository>().To<MarketRepository>();
    kernel.Bind<IModelRepository>().To<ModelRepository>();
    kernel.Bind<IOrderRepository>().To<OrderRepository>();
}  

A:

You can add it to a binding:
Bind<IMarketRepository>().To<MarketRepository>().WithConstructorArgument("sessionId", "Session ID here");

