You can provide an optional IParameter when calling Get<T> so that you can register your db name as follows:
kernel.Get<ISessionFactory>(new Parameter("dbName", "somefile.db", false);
Then you can access the provided Parameters collection using IContext (sysntax is a bit verbose):
kernel.Bind<ISessionFactory>().ToMethod(x => { var parameter = x.Parameters.SingleOrDefault(p => p.Name == "dbName"); var dbName = "someDefault.db"; if (parameter != null) { dbName = (string) parameter.GetValue(x, x.Request.Target); } return Fluently.Configure() .Database(SQLiteConfiguration.Standard .UsingFile(CreateOrGetDataFile(dbName)))
source share